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