Suppose I write two functions:
int f() {
return 1;
}
int g() {
int* x = &f();
}
I can't compile this in C, because you "cannot take the address of an rvalue". That makes sense, because the return value from f lives in a register. (That is to say, it doesn't have an address to assign.)
On the other hand, I can compile this:
int h(int x) {
int* y = &x;
return 0;
}
Why? The argument to h also lives in a register, so it should not have an address. What am I misunderstanding?