References and Pointers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

References and Pointers

Why is references and pointers usefull? What we can do with their memory address.

20th May 2020, 5:06 AM
Ketan Pal
Ketan Pal - avatar
2 Answers
+ 4
They allow you to indirectly manipulate the data they are associated with. This allows for better memory management, particularly when working with functions. Pointers are more efficient as c++ does less work when using them than by passing a value by reference or by passing the value itself. There are also some situations where pointers must be used, such as dynamic memory allocation.
20th May 2020, 5:31 AM
Elizabeth Kelly
Elizabeth Kelly - avatar
+ 3
Ketan Pal If somebody wants to see your house, do you take your house with you and show them, or instead point them to the address of your house?
20th May 2020, 5:34 AM
Bobby Fischer
Bobby Fischer - avatar