← Quiz: Files and Preprocessor: all 10 questions
Quiz: Files and Preprocessor · Question 2 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
#define DOUBLE(x) x + x
int main(void) {
printf("%d", DOUBLE(3) * 2);
return 0;
}
- A.12
- B.9
- C.6
- D.18
Answer & explanation
Correct answer: 9
It expands to 3 + 3 * 2 = 3 + 6 = 9. The macro needed brackets: ((x) + (x)).
Can you get the rest right without peeking?
Take the timed Quiz: Files and Preprocessor quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →