🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: C Output Questions: all 10 questions

Quiz: C Output Questions · Question 8 of 10

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    int i = 5;
    int s = sizeof(i++);
    printf("%d %d\n", i, s);
    return 0;
}
  1. A.6 4
  2. B.5 4
  3. C.5 5
  4. D.6 5
Answer & explanation

Correct answer: 5 4

sizeof only looks at the type of its operand; i++ is never executed. An int is 4 bytes on common systems.

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 →