[OCLUG-devel] problems with atof()
James Colannino
james at colannino.org
Sun Jul 11 16:40:21 PDT 2004
Anyone know why the following won't work? I'm compiling with gcc 3.3.3
if that makes a difference.
#include <stdio.h>
int main()
{
char number[] = "1.293";
double number_float = atof(number);
printf ("\nnumber is: %f\n\n", number_float);
return 0;
}
Instead of printing to the screen something even vaguely resembling
1.293, it instead shows me the following (perhaps it would be different
on a different macine):
-996432413.000000
I'm pretty sure I'm using atof() correctly, and I'm not sure why this is
happening :(
James
--
My blog: http://www.crazydrclaw.com/
My homepage: http://james.colannino.org/
"There are no uninteresting things; only uninterested people." --G.K.
Chesterton
More information about the OCLUG-devel
mailing list