Question 6
Back to Exercise
The program below has a bug. Which statement correctly describes it?
#include <stdio.h>
int main(void) {
int 2nd_place = 2;
printf("%d\n", 2nd_place);
return 0;
}
- A Underscores are not allowed
- B An identifier cannot begin with a digit; rename it, e.g. second_place Correct
- C The value must be a string
- D There is no bug
Correct Answer: Option B
The compiler reads 2nd_place as a malformed number. Identifiers must start with a letter or underscore.
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!