atof

convert a string to a double representation

Synopsis:

#include <stdlib.h>
double atof( const char *ptr );

Description:

The atof() function converts the string pointed to by ptr to double representation. It is equivalent to

strtod( ptr, (char **)NULL )

Returns:

When an error has occurred, errno contains a value indicating the type of error that has been detected.

See also:

errno, sscanf(), strtod()

Examples:

#include <stdlib.h>

void main()
  {
    double x;

    x = atof( "3.1415926" );
  }

Classification:

ANSI

Systems:

Math