S
Shel Sherman
What's wrong with this code? Using Gcc in Fedora 4 it gives the wrong value
for x unless it is declared a float.
#include <stdio.h>
int main{
char * estr = "1.234";
double x = 0;
sscanf(estr, "%g", &x);
printf("%g", x);
return 0;
}
typical result is x = -0.0140015.
Thanks,
Shel Sherman
for x unless it is declared a float.
#include <stdio.h>
int main{
char * estr = "1.234";
double x = 0;
sscanf(estr, "%g", &x);
printf("%g", x);
return 0;
}
typical result is x = -0.0140015.
Thanks,
Shel Sherman