strtof()

Character array conversion to floating point value of type float.

  #include <stdlib.h>
  
  float strtof( const char *nptr, char **endptr);    
Parameter

nptr

A pointer to a nul-terminated character string to convert.

endptr

A pointer to a position in nptr that follows the converted part.

Remarks

The strtof() function converts a character array, pointed to by nptr, to a floating point value of type float. The character array can be in either decimal or hexadecimal floating point constant notation (examples: 103.578, 1.03578e+02, or 0x1.9efef9p+6).

If the endptr argument is not a null pointer, it is assigned a pointer to a position within the character array pointed to by nptr. This position marks the first character that is not convertible to a value of type float.

In other than the "C" locale, additional locale-specific subject sequence forms may be accepted.

This function skips leading white space.

strtof() returns a floating point value of type float. If nptr cannot be converted to an expressible float value, strtof() returns HUGE_VAL, defined in math.h, and sets errno to ERANGE.