C Programming

⌘K
  1. Home
  2. Docs
  3. C Programming
  4. Pointers
  5. Pointer to Pointer

Pointer to Pointer

A pointer to pointer is a form of multiple indirection, or a chain of pointers. It means a pointer that stores the address of another pointer.

Thank you for reading this post, don't forget to subscribe!
  • If a is a variable,
  • *p is a pointer to a,
  • **pp is a pointer to p.

Syntax:

type **ptr_to_ptr;

Example:

#include <stdio.h>

int main() {
    int a = 10;
    int *p = &a;      // pointer to int
    int **pp = &p;    // pointer to pointer to int

    printf("Value of a: %d\n", a);
    printf("Value via *p: %d\n", *p);
    printf("Value via **pp: %d\n", **pp);

    return 0;
}

Output:

Value of a: 10
Value via *p: 10
Value via **pp: 10

How can we help?