Is
--foo++;
a valid statement in C? (Will it compile/run) And is there any practical application for this?
Sorry for changing the question in an edit but I found something out.
According to my C++ compiler (Visual Studio 2010):
--++foo;
is a valid command but
foo--++;
is not. Is there any reason for this?
No, it is not valid because the result of the increment / decrement operators is not a lvalue.
EDIT: the OP edited his question by adding two more examples . So here we go, for the same reason:
are all invalid expression statements because the result of increment / decrement operators is not a lvalue. A compiler could extend the language and accepts these expressions, but a strictly conforming program cannot contain any of these expressions.