Reference variable

Can reference variable have a particular memory block means .Can reference variable take a memory space

Hi @dhirajsharma20042001
The reference variables are most of the time optimized away and no variable is created for the reference. However, in some cases where the reference variable cannot be optimized away, it’s implemented as a 4 byte pointer to the original object.

So in most of the cases, the compilers use the actual object instead of the reference variables in statements where a reference is involved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.