Which of the given function converts the string pointed to, by the argument str to a floating-point number?

Which of the given function converts the string pointed to, by the argument str to a floating-point number?
A. atof(const char *str)
B. strtod(const char *str, char **endptr)
C. atoi(const char *str)
D. atol(const char *str)
 
Answer: a
Explanation: The atof function converts the initial portion of the string pointed to by str to double representation. Except for the behavior on the error, it is equivalent to strtod (nptr, (char **)NULL).
 

Tìm kiếm

Back
Top