Take the 2-minute tour ×  I'm trying to do something fairly
simple. Of course it could be done with an extra line of code,
but technically speaking, why does this not work?  int foo = 5;
int *bar = &(--foo);  GCC compiler tells me "invalid lvalue in
unary &"  share|improve this question add comment  5 Answers  up
vote 5 down vote accepted  Because --foo is not an lvalue (so
named since they typicaly appeared on the left of an asignment).
It's the same problem with:  --foo = 7;  If, for some bizarre
reason, you need it on one line, just use:  --foo; int *bar =
&foo;  If you think you need it in one instruction, think again.
Even if you make such a horrible monstrosity (a), it will
probably compile down to the same machine language sequence as
that code snippet above.  (a) int *bar = (--foo, &(foo));
share|improve this answer Could also do: int *bar = --foo,
&foo;. –  GManNickG Mar 30 '11 at 3:13 Close, @GMan, problematic
since I think the comma is being taken as a declaration
separator rather than the comma