How to return a string from the function:
char * temp;
int main()
{
temp = malloc(129);
double g_symbol_b_amount = 8536.700000;
printf("\n value: %s\t ", format_double_trans_amount(double g_symbol_b_amount));
}
char *format_double_trans_amount(double amount)
{
char amount_array_n1[25];
strcpy(amount_array_n, "");
sprintf(amount_array_n, "%1f", amount);
temp = amount_array_n;
return temp;
}
Here I got the value: 0.000000
I need the orginal value, please help me on this?
amount_array_n? Does this compile for you? Can you show the exact output generated?