+ 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?
10 Respuestas
+ 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.
+ 14
Lists that point to other lists perhaps?
+ 10
you can use it when you decide to use pointer to access a multidimensional array
+ 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
+ 5
In order to know address of first pointer
It used when we create chain of linking nodes
+ 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)
+ 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!!!
+ 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 ...
+ 2
I found the best answer to this question here
https://stackoverflow.com/questions/5580761/why-use-double-pointer-or-why-use-pointers-to-pointers?newreg=afe32c63c91a4fddadb426beeb261891
+ 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 */