B
BCC
Can someone please explain this to me... if I have:
int x = 10;
I can do:
int* p_x = &x;
Compiles okay.
If I have a function though:
int ReturnInt() { return x; }
// Where x = 10;
and then do:
int* p_x = &ReturnInt();
I get a compiler error "C2102 '&' requires l-value".
I had thought that these should be the same. Clearly they are not, but Im
not sure why.
Thanks,
B
int x = 10;
I can do:
int* p_x = &x;
Compiles okay.
If I have a function though:
int ReturnInt() { return x; }
// Where x = 10;
and then do:
int* p_x = &ReturnInt();
I get a compiler error "C2102 '&' requires l-value".
I had thought that these should be the same. Clearly they are not, but Im
not sure why.
Thanks,
B