Reputation: 1047
Ok so lets say I have function(int& myval)
, if in the body of that function I do &myval
will that point to the parameter on the stack or the original value?
Upvotes: 0
Views: 132
Reputation: 487
As said by Sombrero Chicken, a reference doesn't have an address: consider it like an "alias" of the referenced variable, just another name to reference it ( nomen omen)
Upvotes: 0
Reputation: 36483
References don't have an address, using the address-of operator &
on a reference type will return the address of the variable that the reference is bound to.
Upvotes: 5