{{keywords>wiki library source code example reference}} ===== atof ===== #include double atof(const char *str); ===== Description ===== The atof() function converts the initial portion of the string pointed to by nptr to double. The behavior is the same as strtod(nptr, (char **) NULL); except that atof() does not detect errors. ===== C Sourcecode Example ===== #include /* including standard library */ //#include /* uncomment this for Windows */ #include int main(void){ char string[]="1234"; float i; printf("string = %s \n", string ); printf("int = %f \n", atof(string) ); i = atof(string); i = i + i; printf("i + i = %f\n", i); return 0; } ==== Output ==== Output: user@host:~$ ./atof string = 1234 int = 1234.000000 i + i = 2468.000000