What is pointers in C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is pointers in C++

can I get a practical explanation how I can use them in a program

5th May 2017, 3:59 PM
Sello Selby Bopape
Sello Selby Bopape - avatar
9 Answers
+ 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.
5th May 2017, 4:06 PM
Bebida Roja
Bebida Roja - avatar
+ 5
you just did *learn
5th May 2017, 4:10 PM
jay
jay - avatar
+ 5
@jay thanks
5th May 2017, 4:28 PM
Sello Selby Bopape
Sello Selby Bopape - avatar
+ 5
@Aman thanks
5th May 2017, 4:29 PM
Sello Selby Bopape
Sello Selby Bopape - avatar
+ 5
thank you to all who took their time and effort to make me understand pointers a bit better I appreciate that a lot
5th May 2017, 4:37 PM
Sello Selby Bopape
Sello Selby Bopape - avatar
+ 5
@bebida thanks to u as well
5th May 2017, 4:38 PM
Sello Selby Bopape
Sello Selby Bopape - avatar
+ 5
https://code.sololearn.com/coYYZpAaI8Pm/?ref=app here is a working simple example
5th May 2017, 5:11 PM
jay
jay - avatar
+ 3
how difficult are they to learn?
5th May 2017, 4:08 PM
Sello Selby Bopape
Sello Selby Bopape - avatar