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

Discussion

scanf() or atoi() function can be used to convert a string like "436" in to integer.

  • A.Yes
  • B.No

Answer: A

Correct answer: Yes

Both work. atoi("436") converts the string directly, and sscanf(str, "%d", &n) does the same with error reporting. strtol is better than either, since it distinguishes a genuine 0 from a failed conversion.

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

Post your comment

Please log in or register to post a comment.