Question 6
Back to Exercise
The program below has a bug. Which statement correctly describes it?
#include <stdio.h>
int main(void) {
putchar("A");
putchar('\n');
return 0;
}
- A putchar needs stdout as an argument
- B "A" is a string (a char pointer); putchar takes one character, so it should be putchar('A') Correct
- C putchar returns void
- D There is no bug
Correct Answer: Option B
Single quotes make a character constant, double quotes a string. To print a whole string use puts() or fputs().
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!