Pointers to Pointers

Pointers to Pointers :

As we learned before the pointer is variable which can hold the address of another variable. So pointer to a pointer means that pointer has the address of another pointer which is pointing to an exact actual value.

In this way, we can point to any number of pointers. What did it mean finally? Pointer has the address of another variable and a pointer to a pointer or double pointer or triple pointer means it will point to another pointer address to another pointer address and goes on…

For more understanding let’s check the example

#include <stdio.h>

#include <stdlib.h>

int main()


int a=10; // Initializing the variable a with 10.

int *p; // Declaration of pointer p.

int **ptr; // Declaration of double pointer ptr

p=&a; // Initializing the pointer p with the address of a

ptr=&p; // Initializing the double pointer ptr with the address of p


printf(“Address of a =%p\n”,&a);

printf(“Address of *p =%p\n”,&p);

printf(“Address of **ptr =%p\n”,&ptr);



printf(“Value of a =%d\n”,a);

printf(“Value of *p =%p\n”,p);

printf(“Value of **ptr =%p\n”,ptr);



printf(“print the values pointing by the pointers:\n”);



printf(“Pointing value of a =%d\n”,a);

printf(“Pointing value of *p =%d\n”,*p);

printf(“Pointing value of **ptr =%d\n”,**ptr);




printf(“Pointing value of **ptr =%p\n”,*ptr);

return 0;



In the above program explains the pointer and double pointer concepts.

First, we are printing the address of each variable .ie, a,*p,**ptr. We can see the three different addresses associated with that variables.

The second set of printfs shows the values hold by the variables. Variable a is have its own value 10. And pointer variable p has the value which the address of a. Similarly, the double pointer has the value which is the address of pointer variable p.

Third set which explains the concept of a pointer or double pointer.

In the first line of a third set value of a is 10. The de-referenced value of pointer p(*p) is 10, that is pointer p points to the address of a and from that address, it is de-referencing the value 10. In the last line double referencing the pointer ptr. That is first it points to the address of pointer p from there points to the address of p and dereferencing the address of pointer p and then prints the value 10.

At last, we are discussing for more clarity, the double pointer points to the first points to the address of pointer p that is 0060ff0c.


    Your Name*


    Phone Number*

    Email Address*