Chain of Pointers
https://www.computersprofessor.com/2016/05/chain-of-pointers.html
Chain of pointers:
It is
possible to make a pointer to point to another pointer, thus creating a chain
of pointers.
Here, the pointer variable p2 contains the add of the
pointer variable P1, which points to the location that contains the
desired value. This is known as multiple indirection's.
A
variable that is a pointer to a pointer must be declared using additional
indirection operator symbols in front of the name.
Ex:–
int **p2;
This
declaration tells the compiler that p2 is a pointer to a pointer of int type.
Ex:–
#include
main()
{
Int x, *p1,
**p2;
x=100;
p1=&x;
p2=&p1;
printf(“%d”, **p2);
}
This
code will display the value 100. Here, P1 is declared as a pointer to an
integer & p2 as a declared as a pointer to an integer & p2 as a pointer
to a pointer to an integer.