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 ?
- Double (**) is used to denote the double Pointer
- Pointer Stores the address of the Variable
- Double Pointer Stores the address of the Pointer Variable
Statement | What will be the Output ? |
*ptr | 45 |
**ptr2ptr | 45 |
ptr | &n |
ptr2ptr | &ptr |
Notes :
- Conceptually we can have Triple ….. n pointers
- Example : *****n,****b can be another example
Live Example :
#include<stdio.h> int main() { int num = 45 , *ptr , **ptr2ptr ; ptr = # ptr2ptr = &ptr; printf("%d",**ptr2ptr); return(0); }
Output :
45