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

A pointer variable in C language can also contain address of another pointer variable. This concepts is called pointer to pointer. We can declare a pointer to pointer as:
int **ptr;
Here, ptr is a pointer to pointer.

Program of pointer to pointer.
int main()

int var1=20,*var2,**ptr;



printf(“\n**ptr=%d “,**ptr);


In the above program, ptr is pointer to pointer. It contains address of aother pointer variable var2 which contains the address of variable var1.
*var2 refers to the value of var1.
*ptr refers to the address of var1.
**ptr refers to the value of variable var1.

Best Books of C

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