Pointer to pointer in c

You must first complete Introduction to pointer in C | pointer operations in C before viewing this Lesson

Pointer to pointer

C language allows us to take pointer variables which can contain address of other pointer variables. In such a case, the concept of pointer to pointer is used. The pointer to pointer variable can be declared by prefixing the variable declaration with double asterisk sign.
int **a;
Here, pointer variable a is pointer to pointer variable as it is prefixed with two asterisk signs.

Program to demonstrate pointer to pointer.
int main()
{int a=10,*b,**c;b=&a;
printf(“\n*b=%d “,*b);
printf(“\n**c=%d “,**c);


In the above program, c is pointer to pointer variable and it contains the address of other pointer variable b which further contains the address of normal variable a.
*b refers to the value of a.
*c refers to the address of a.
**c refers to the value of variable a.

Best Books of C

Lesson tags: pointer to pointer, program of pointer to pointer in c
Back to: C Programming Language