What does the following C statement mean? scanf("%4s", str);
2018
What does the following C statement mean? scanf("%4s", str);
- A.
Read exactly 4 characters from console
- B.
Read maximum 4 characters from console
- C.
Read a string in multiples of 4
- D.
None of the above
Attempted by 1547 students.
Show answer & explanation
Correct answer: B
Explanation: %4s reads at most 4 non-whitespace characters from input and stores them as a C string.
A video solution is available for this question — log in and enroll to watch it.