Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of the given function differs from the statement’errno is not necessarily set on conversion error’?

  • A.atof()
  • B.atoi()
  • C.atol()
  • D.strtod()

Answer: D

Correct answer: strtod()

strtod is the one that does report errors: on overflow or underflow it sets errno to ERANGE, and it also returns a pointer to the first unconverted character. The ato family - atoi, atof, atol - simply return 0 on failure and set nothing, which is why the strto functions should be preferred.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.