After reading this pointer to pointer topic, you will understand its theory and examples also you will able to implement it in C programming.
In c pointer to pointer, the second pointer contains the address of the first pointer, which points to the memory location that contains the desired value. The example below will show how pointer to pointer used in C programming.
Example:
Program (1): To demonstrate the use of Address operator and Indirection operator in C programming.
#include<stdio.h> #include<conio.h> void main(void) { int i=10; int *k,**j; k=&i; printf("value of i = printf("\nvalue of i = printf("\naddress of i = printf("\naddress of i = printf("\naddress of i = printf("\nvalue of k = printf("\nvalue of k = j=&k; printf("\nvalue of k = printf("\naddress of k = printf("\nvalue of j = printf("\nvalue of k = printf("\naddress of j = getch(); }
Output (1)
value of i = 10 value of i = 10 address of i = 1703752 address of i = 1703752 address of i = 1703752 value of k = 1703748 value of k = 1703748 value of k = 1703752 address of k = 1703748 value of j = 1703748 value of k = 10 address of j = 1703744