← Quiz: C Pointers: all 10 questions
Quiz: C Pointers · Question 6 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int main(void) {
int x = 10;
int *p = &x;
int **pp = &p;
**pp = 25;
printf("%d %d\n", x, *p);
return 0;
}
- A.10 25
- B.25 25
- C.10 10
- D.Compile error
Answer & explanation
Correct answer: 25 25
pp points to p, which points to x, so **pp is x itself. Changing it changes x, and *p reads the same x.
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 →