Question 8
Back to Exercise
What is the output of the following C program?
#include <stdio.h>
int main(void) {
int x = 5;
int *p = &x;
int **pp = &p;
**pp = 50;
printf("%d %d %d\n", x, *p, **pp);
return 0;
}
- A 5 5 50
- B 5 50 50
- C 50 50 50 Correct
- D Compilation error
Correct Answer: Option C
pp points to p, and p points to x. **pp follows both arrows and lands on x, so x becomes 50. All three expressions read x.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!