+ 2
Please can anyone help me with the difference between a Reference and a Memory address. Thanks.
Difference between Reference and Memory Address
2 Answers
+ 2
I'm not qualified to answer this question, since the true nature of how a reference is implemented is complicated. I'll write what I know, maybe someone will correct me later.
A reference is an alias (another name) for the variable it is initialized with. Think of it like a weird-looking, constant, funny pointer that points to a variable's memory address. The compiler often replaces a reference with the address of the variable it refers to when said reference is encountered.
A reference is not a memory address, and also doesn't have an address of its own (which is different from a pointer).
+ 1
Thanks for your explanation