🎙 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 3 of 10

What does this print? (code)

What does this print?

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

Correct answer: 3

*(p + 3) is 4 and *p is 1, so 3.

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 →