Can anyone explain. Me about pointers?? Challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Can anyone explain. Me about pointers?? Challenge

i am learning c++ but i dont understand what is the use of it and why we have to about the location of any identifier

30th May 2017, 7:41 PM
Faraz Anwar
Faraz Anwar - avatar
5 Answers
+ 5
In this example I use pointers to the item object to avoid having to store a copy in inventory item struct. When it comes time to create/save a file. I will dereference the pointer and store the name instead of saving the memory address (not shown) https://code.sololearn.com/cpF61pq6Qauo/?ref=app
31st May 2017, 12:44 AM
jay
jay - avatar
+ 2
https://code.sololearn.com/coYYZpAaI8Pm/?ref=app
31st May 2017, 12:38 AM
jay
jay - avatar
+ 2
We use them so we do not have to create a copy of the variable when we pass it around to other functions and stuff. Saves memory/avoids confusion.
31st May 2017, 12:40 AM
jay
jay - avatar
0
yeaaaa
1st Jun 2017, 4:39 PM
bandmanCAH
0
...
1st Jun 2017, 4:40 PM
DeAngelo