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 304 students.
Show answer & explanation
Correct answer: B
In scanf, the width specifier %4s reads at most four characters into the string.