So , when we declare a cpp reference under the hood a pointer a declared.
The reference in itself doesn’t consume any memory , and when we use the address of operator with a reference it turns out that reference has the same address as compared to the variable it is referring to.
So how does it work out , like is it whenever we use the reference the compiler replaces it with the variable it is referring to or how does that work out ?
Also how can we access the pointer that was declared under the hood when a reference is initialized?
I am really confused and don;t know how to think at it.
SidharthSura is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1