Do you think pointer and reference are the same thing? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Do you think pointer and reference are the same thing?

Well, they are two different things , but are very similar. How really different are them? Just a matter of style?

17th Feb 2019, 3:23 PM
AZTECCO
AZTECCO - avatar
3 Answers
+ 7
Reference variables are like pointers behind the scenes. A reference is apparently a name constant to an address that cannot be further modified unlike a pointer.
18th Feb 2019, 7:23 AM
Sonic
Sonic - avatar
0
Pointers hold references, references are addresses to variables.
17th Feb 2019, 9:56 PM
Coordinate Newton
Coordinate Newton - avatar
0
~ swim ~ good answer as usual. This is usually the natural implementation of a reference. But I must add that the language standard does not require any particular mechanism, whether a reference uses storage or not is unspecified, one cannot write code assuming references are implemented as pointers.
18th Feb 2019, 10:51 AM
AZTECCO
AZTECCO - avatar