Is there any exception to rule that if I can find address using & it's l-value otherwise r-value?
For example,
int i;
&i
will give address of i, but I cannot take address of (i + 5)
, unless I is pointer or array.
Regards
Is there any exception to rule that if I can find address using & it's l-value otherwise r-value?
For example,
int i;
&i
will give address of i, but I cannot take address of (i + 5)
, unless I is pointer or array.
Regards
The most obvious exception is overloading the prefix
&
operator for your own type:This prints the address of the temporary object, which happens to be
0x7fff76012d9f
when I ran it.