E
Earth
Hi all,
I am new to c and trying the sprintf function.
I have written a testing program to try the sprintf fuction and expect
the output is 1.234. However, the output shows nothing.
Am I missing sth here?
Thanks in advance for you inputs.
Earth
#include <stdio.h>
char* toString(double d)
{
char buffer[9];
sprintf(buffer, "%lf", d);
return buffer;
}
main()
{
printf("%s\n", toString(1.234));
}
I am new to c and trying the sprintf function.
I have written a testing program to try the sprintf fuction and expect
the output is 1.234. However, the output shows nothing.
Am I missing sth here?
Thanks in advance for you inputs.
Earth
#include <stdio.h>
char* toString(double d)
{
char buffer[9];
sprintf(buffer, "%lf", d);
return buffer;
}
main()
{
printf("%s\n", toString(1.234));
}