C Programming/stdlib.h/atof

atof is a function in the C programming language that converts a string into a floating point numerical representation. stands for ASCII to float. It is included in the C standard library header file. Its prototype is as follows:

The  argument points to a string, represented by an array of characters, containing the character representation of a floating point value. If the string is not a valid textual representation of a,   will silently fail, returning zero (0.0) in that case.

Note that while  and   return variable types corresponding with their name (" " returns an integer and " " returns a long integer), atof however, does not return a  , it returns a.

A related function is sscanf. This function extracts values from strings and its return argument is the number of valid values it managed to extract (so, unlike,    can be used to test if a string starts with a valid number).