+ 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
5 Réponses
+ 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
+ 2
https://code.sololearn.com/coYYZpAaI8Pm/?ref=app
+ 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.
0
yeaaaa
0
...