The following example let Understanding Pointer to a Pointer in C.

In order to provide multiple indirection, we can use pointer to pointer. Basically, a pointer refers to a location in memory where actual value is present. Similarly, a pointer to a pointer contains address of that address (pointer). Further indirection represent address at the next level.

For instance, in he following example, x contains a value of 300. While, y contains the address of x. Likewise, z and k contain the address of y and z respectively. Furthermore, we can change the value of x by using pointer to a pointer. Therefore, the expression ++***k increments the value of x by 1.

// Pointer to Pointer

#include <stdio.h>

int main()
{
    int x;
    int *y;
    int **z;
    int ***k;
    x=300;
    y=&x;
    z=&y;
    k=&z;
    printf("\nx=%d", x);
    printf("\ny=%x", y);
    printf("\nz=%x", z);
    printf("\nk=%x", k);
    
    printf("\n*y=%d", *y);
    printf("\n**z=%d", **z);
    printf("\n***k=%d", ***k);
    
    printf("\nUpdating Values using pointer...");
    ++***k;

    printf("\nx=%d", x);
    printf("\n*y=%d", *y);
    printf("\n**z=%d", **z);
    printf("\n***k=%d", ***k);
    
    return 0;
}

Output

x=300
y=f01998ec
z=f01998f0
k=f01998f8
*y=300
**z=300
***k=300
Updating Values using pointer…
x=301
*y=301
**z=301
***k=301


Further Reading

50+ C Programming Interview Questions and Answers

C Program to Find Factorial of a Number