Consider the following code snippet:
char str[1000];
float b ;
b= 0.0615;
sprintf( &(str[0]), "%1.0e", b);
After the execution of the last statement, I expected the str
to contain 6.15e-2
. However, I am getting the value as 5e-315
.
Where am I going wrong. How to get the expected value?