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

Quiz: C Pointers · Question 8 of 10

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    int a[] = {5, 6, 7};
    int *p = a;
    int x = *p++;
    printf("%d %d\n", x, *p);
    return 0;
}
  1. A.6 6
  2. B.6 7
  3. C.5 6
  4. D.5 5
Answer & explanation

Correct answer: 5 6

*p++ reads the value at p (5) and then moves p to the next element, which holds 6.

Can you get the rest right without peeking?

Take the timed Quiz: C Pointers quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →