C double pointer

Pointer to Pointer in C Programming

Declaration : Double Pointer

int  **ptr2ptr;

Consider the Following Example :

int num = 45 , *ptr , **ptr2ptr ;
ptr = #
ptr2ptr = &ptr;

What is Pointer to Pointer ?

  1. Double (**) is used to denote the double Pointer
  2. Pointer Stores the address of the Variable
  3. Double Pointer Stores the address of the Pointer Variable


StatementWhat will be the Output ?
*ptr45
**ptr2ptr45
ptr&n
ptr2ptr&ptr

Notes :

  1. Conceptually we can have Triple ….. n pointers
  2. Example : *****n,****b can be another example

Live Example :

#include<stdio.h>
int main()
{
int num = 45 , *ptr , **ptr2ptr ;
ptr     = &num;
ptr2ptr = &ptr;
printf("%d",**ptr2ptr);
return(0);
}

Output :

45