what is internal represtation of reference variable
How is a reference represented internally and how does it differ from a pointer
Collapse
X
-
Tags: None
-
A pointer.
Except in this case the pointer is managed by the compiler so there won't be any mistakes made.
The original variable is inbthe stack frame of the calling function. The reference is a pointer in the called functions stack fram back to the original variable. Code is generated to do the address-of on the call and the de-reference as necessary in the called function.
Since this is a generated pointer, you can't change it to point to something else hence the restriction that you can't change the reference once it's established. -
problem in reference
what is the use of reference variable when the same work is done using address of (&) and dereference(*) operatorComment
-
query of reference
can u show me with help of diagram internal represntation of reference variable?Comment
-
Please do not double post questions and keep all related question about a single topic in a single thread.
Please read the Posting Guidelines .
Banfa
AdministratorComment
-
Because you make mistakes using & and * and the compiler doesn't.Originally posted by himanigargwhat is the use of reference variable when the same work is done using address of (&) and dereference(*) operator
Did not not read post #2??? It's a pointer managed by the compiler.Originally posted by himanigargcan u show me with help of diagram internal represntation of reference variable?Comment
Comment