I was wondering, why the following way of code (Already commented out) will cause
C2102: \'&\' requires l-value
Is there a better way to avoid u
You could instead define:
int **get_dummy() ... return &dummy;
You can think of an r-value as an expression, essentially, whereas an l-value is an actual object. Expressions don't have addresses, and even if they did, it's hard to imagine what good the address would be. It's easy to understand how the address of an object can be useful.
It's a bit hard to understand an issue like this abstractly. The very best way to develop an understanding of pointers and compiled languages is to learn assembly language.