+ 4
What is pointers in C++
can I get a practical explanation how I can use them in a program
9 Respuestas
+ 5
They are variables which points to an object. Suppose you want the contents of a webpage. I could send you all the contents myself, but it is more useful to send an url. it takes less memory. A pointer is the url in this analogy.
You create by putting a class name, then add a * and then insert the pointer name. You initialize them with the new operator. As an example:
Node* next = new Node;
There are other ways to initialize them but you should find that on the internet, as there is a lot to say about pointers.
+ 5
you just did *learn
+ 5
@jay thanks
+ 5
@Aman thanks
+ 5
thank you to all who took their time and effort to make me understand pointers a bit better I appreciate that a lot
+ 5
@bebida thanks to u as well
+ 5
https://code.sololearn.com/coYYZpAaI8Pm/?ref=app
here is a working simple example
+ 3
how difficult are they to learn?