Pointer to pointer in c

Pointer to pointer in C  Language

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 in C

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.

Popular Books of Computer Science

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