+ 11

Why would you want a pointer referencing to another pointer?

If you're not sure what I'm talking about, check out Md Sharique 's answer in this post: https://www.sololearn.com/Discuss/1799281/?ref=app In what case would you actually use a pointer referencing another pointer?

20th May 2019, 11:22 AM
luʁi
11 Réponses
+ 17
that is the basic concepts about pointers, there is nothing much you can do with just using those. when you're advanced enough, you'll see how useful it is after you head down to the realm of data structures and their memory management techniques with linked lists, trees, and graphs. it's uses is critical in making dynamic memory allocation in C and C++, and gives you a good concept of how computers store and manage their memory. pointers are really beautiful once you understand how to use them.
20th May 2019, 12:25 PM
Shen Bapiro
Shen Bapiro - avatar
+ 14
Lists that point to other lists perhaps?
20th May 2019, 11:23 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 10
you can use it when you decide to use pointer to access a multidimensional array
20th May 2019, 12:16 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 8
It is useful for 2D arrays for example. Another use can be changing a variable via 2 levels of functions. e.g. https://code.sololearn.com/c36xSDug9Ju1/?ref=app
20th May 2019, 9:49 PM
Sonic
Sonic - avatar
+ 5
In order to know address of first pointer It used when we create chain of linking nodes
20th May 2019, 6:12 PM
Malhar Naiya
Malhar Naiya - avatar
+ 4
my understanding of using pointers is very limited but I would think they'll be used when data is stored in a more complex way than usual, like lists pointing to lists oder some multidimensional array stuff. (sry my English is not the best)
20th May 2019, 1:39 PM
Sören Will Nicht Hören
Sören Will Nicht Hören - avatar
+ 3
Pointers is an alternative way to use when you want to use variables via methods and functions especially in C. Think of it like this. When you want a value from a function or a method , you can call the adress of this value, the memory location from the value. In my perspective is easier that way. There are alot of tutorials and analysis if you just search for C pointers in the web. PS : i liked very much the course C here in sololearn, althought it didnt include the method of pointers. It is such a pity!!!
20th May 2019, 2:33 PM
MarieK
MarieK - avatar
+ 3
Suppose the first 15 addresses on the stack are related, you could use double indirection to store the last address on the second one. This would be better memory management I guess 🤔. Data would be stored on the heap as usual ...
21st May 2019, 2:39 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 1
Pointer is a variable which is used to store the address of the simple variable of the same datatype. E.g. Int a,*p; p=&a; /*p is a pointer which is variable used to store the address of a */ But pointer to pointer is variable used to store the address of other pointer variable same datatype. E.g. Int a,*p,**b; p=&a; b=&p; /*b is pointer to pointer variable used to store the address of pointer p */
21st May 2019, 3:47 AM
Jemini Bhut