← Quiz: C Output Questions: all 10 questions
Quiz: C Output Questions · Question 10 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int main(void) {
int i = 0, j = 0;
if (i++ && j++) printf("yes ");
printf("%d %d\n", i, j);
return 0;
}
- A.yes 1 1
- B.1 1
- C.1 0
- D.0 0
Answer & explanation
Correct answer: 1 0
i++ gives 0 (false) and then makes i 1. Since the left side of && is false, j++ is skipped.
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 →