In the C Programming Language, the atof function converts a string to a floating-point number (double).
The atof function skips all white-space characters at the starting of the string, converts the subsequent characters as part of the number, and then stops when it encounters the first character that is not a number.
Syntax
The syntax for the atof feature in the C Language is:
double atof(const char *nptr);
Parameters or Arguments
nptr A pointer to a string to convert to a floating-point number (double).
Returns
The atof function returns the floating-point representation of a string. The atof feature skips all white-space characters at the starting of the string, converts the subsequent characters as phase of the number, and then stops when it encounters the first persona that is not a number.
Required Header
In the C Language, the required header for the atof function is:
#include <stdlib.h>
Applies To
In the C Language, the atof characteristic can be used in the following versions:
ANSI/ISO 9899-1990
Similar Functions
Other C functions that are comparable to the atof function:
atoi function atol feature strtod feature
See Also
Other C functions that are noteworthy when dealing with the atof function:
strtol feature strtoul characteristic
Leave a Review