Home > Electronics Tutorials > C Language Tutorial > stdlib.h - String Functions - atof

C Language Programming Library Reference Guide

stdlib.h - String Functions - atof

Declaration: double atof(const char *str);

The string pointed to by the argument str is converted to a floating-point number (type double). Any initial whitespace characters are skipped (space, tab, carriage return, new line, vertical tab, or formfeed). The number may consist of an optional sign, a string of digits with an optional decimal character, and an optional e or E followed by a optionally signed exponent. Conversion stops when the first unrecognized character is reached.

On success the converted number is returned. If no conversion can be made, zero is returned. If the value is out of range of the type double, then HUGE_VAL is returned with the appropriate sign and ERANGE is stored in the variable errno. If the value is too small to be returned in the type double, then zero is returned and ERANGE is stored in the variable errno.

Note: To report broken links or to submit your projects, tutorials please email to Webmaster

Discover

     more......