Answer to Question #44246 in Other Programming & Computer Science for Vijayasurya

Question #44246
In pointer Chapter, there is this concept of Pointer to Pointer. Here there are a few declarations 1. int i=50 2. int *ptr 3. int **ptrptr Now, why does a pointer variable that will store the address of another pointer variable have to be declared with double ** ?? why will just one * symbol not do? AND also if i have to declare another pointer that will store the address of ptrptr, should i have to declare it with *** symbols? or how many?
1
Expert's answer
2014-07-16T05:44:21-0400
Dear Vijayasurya,
1.The pointer to pointer variable is indicated with double ** so that you could see that this pointer stores address of another pointer.
If you declare all the pointers (regardless of their depth) with a single star (*) you would be confused soon enough, even if you're dealing with a simple code, as no one can hold everything in the memory.
2. Pointer which stores address of a pointer, which holds address of another pointer should be declared with 3 stars (***). in fact stars quantity increases arithmetically with increasing of depth.
Hope this helps.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal