Diagnostic Quiz
Problems
5. printf() behavior
7. scanf() and fgets()
To read in a 6-letter module code (e.g., "CS1010") from the standard input? We can use
8. Output Analysis
If the input is a floating point number, the first scanf()
at Line 2 will consume the number in front of the floating point and store it in the variable x
. And the scanf()
at Line 4 will read nothing because .
(char) doesn't match with %ld
(long), so x
will still be the same number and is printed out again.
Last updated