← Quiz: C Output Questions: all 10 questions
Quiz: C Output Questions · Question 2 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int main(void) {
int i = 1;
if (i-- && i++) printf("A");
printf("%d", i);
return 0;
}
- A.A1
- B.A0
- C.1
- D.0
Answer & explanation
Correct answer: 1
i-- gives 1 (true) and i becomes 0; then i++ gives 0 (false), so "A" is not printed, and i becomes 1.
Can you get the rest right without peeking?
Take the timed Quiz: C Output Questions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →