Pointer to Pointer in C Programming

  • A pointer to variable is the one which stores the address of another variable of a specific type.
  • A pointer to pointer is a variable which stores the address of the pointer variable of a specific type.
Syntax:
int **var;

Example : Demonstrating pointers to pointers

#include <stdio.h>
void main ()
{
    int  v;
    int  *p;
    int  **pt;
    v = 5000;

    /* take the address of variable */
    p = &v;

    /* take the address of pointer using address of operator & */
    pt = &p;

    /* take the value using pptr */
    printf("Value of variable = %d\n", v );
    printf("Value available at '*p' = %d\n", *p );
    printf("Value available at '**pt' = %d\n", **pt);
}


Output:
Value of variable = 5000
Value available at '*p' = 5000
Value available at '**pt' = 5000