Syntax
#include <stdlib.h>
double strtod(const char *string, char **endptr)
Arguments
string pointer to the character string that is to be converted to a numeric double value
endptr pointer to the pointer to a string of unrecognizable characters
Return Value
The converted numeric value of the double type
Description
It converts the string specified by the string argument to a numeric value of the double type.
It parses the character string using the following format:
[whitespace][{sign}][digits][.digits][{e|E}[sign]digits]
- <whitespace>
- one or more spaces, NULL characters, or tab characters
- <sign>
- + or -
- <digits>
- the decimal character string consisting of more than one digit
An exponent part following e or E can be placed after the decimal number. Conversion is terminated when an unrecognizable character appears as a part of number.
If endptr is not NULL, you can set a pointer to *endptr to determine which unrecognized character terminated the conversion.