1.

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)The question was posed to me during an online interview.This interesting question is from General Utilities in chapter C Library of C

Answer»

Correct CHOICE is (a) atof(const char *STR)

The explanation is: 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).



Discussion

No Comment Found

Related InterviewSolutions