Hi I'm trying to convert a double number in scinetific notation into a string of 4 characters. I have written this code
char result[4]; double corr; sprintf(result,"e", corr);
corr is a decimal number in scientific notation, i have to send this 4 characters to a LCD display, but result variable don't seems to change from value 0x40000020. I use the realview compiler from keil. Please help me Regards Luca
sprintf(result,"e", corr);
You need to study how to write a format string for sprintf!
See any 'C' textbook.
double corr;
"corr is a decimal number in scientific notation"
No, it's not - it is a double, in whatever format the compiler chooses to use for its double data type!
... a string of 4 characters. I have written this code:
char result[4];
How many characters does 'C' require for a string of four characters...?