Explanatory Question
What is pointer to pointer in C?
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.
In case of a pointer to pointer concept, one pointer refers to the address of another pointer. The pointer to pointer is a chain of pointers. Generally, the pointer contains the address of a variable. The pointer to pointer contains the address of a first pointer. Let's understand this concept through an example:
Output:#include int main() { int a=10; int *ptr,**pptr; // *ptr is a pointer and **pptr is a double pointer. ptr=&a; pptr=&ptr; printf("value of a is:%d",a); printf("\n"); printf("value of *ptr is : %d",*ptr); printf("\n"); printf("value of **pptr is : %d",**pptr); return 0; }
In the above example, pptr is a double pointer pointing to the address of the ptr variable and ptr points to the address of 'a' variable.
First read the answer fully, then try to explain it in your own words. After that, open a few related questions and compare the concepts. This method helps you remember the topic for a longer time and improves exam preparation.