Pointer to Pointer
Completed
Read two integers a and b. Make int *p = &a; and int **pp = &p;. Print **pp, then make *pp point to b and print *p, then set **pp = 100 and print a and b.
Input
Two integers.
Output
Three lines.
Example
Input
1 2
Output
1 2 1 100
Editor
C
Hints
*pp is p itself; **pp is what p points to.
Solution explanation
Changing *pp redirects p; changing **pp changes the int p points to.
Show solution
#include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
int *p = &a;
int **pp = &p;
printf("%d\n", **pp);
*pp = &b;
printf("%d\n", *p);
**pp = 100;
printf("%d %d\n", a, b);
return 0;
}