ProgrammingEasyWipro · Capgemini pattern

What is printed?

What is printed?
int x = 10;
int *p = &x;
int **q = &p;
**q = 20;
*p += 5;
printf("%d", x);
  1. A. 25
  2. B. 15
  3. C. 20
  4. D. 10

Correct answer: A. 25

q points to p, which points to x, so **q = 20 writes x. *p += 5 then adds 5 to the same x: 25.

More C Programming questions

Exams that ask this topic