c - Converting char* to float or double - Stack Overflow
You are missing an include : #include , so GCC creates an implicit declaration of atof and atod, leading to garbage values. And the format specifier for double is %f, not %d (that is for integers). #include #include int main() { char *test ......