Question 1
Back to Exercise
What does scanf() return?
- A The number of characters read
- B The number of input items successfully assigned, or EOF if input ends first Correct
- C Always 0 on success
- D The last value read
Correct Answer: Option B
Comparing the return value with the expected count (scanf("%d %d", &a, &b) == 2) is the standard way to validate input.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!