Why ** pointer is used?

What is the use of **pointer , please explain

20201028_131512

head stores the address of a pointer

1 Like

We already know that a pointer points to a location in memory and thus used to store the address of variables. So, when we define a pointer to pointer. The first pointer is used to store the address of the variable. And the second pointer is used to store the address of the first pointer. That is why they are also known as double pointers.

Below diagram explains the concept of Double Pointers:

The above diagram shows the memory representation of a pointer to pointer. The first pointer ptr1 stores the address of the variable and the second pointer ptr2 stores the address of the first pointer.

1 Like