Assuming the question is about the built-in operators ++ and -- , none of these statements are strictly legal.
The first two are well formed, i.e. just compiled because the result of the prefix increment is lvalue. The last two are poorly formed, since the result of the postfix increment is not an rvalue value, so you cannot assign it to it.
However, even the first two are not legal in a sense that they give rise to undefined behavior. You cannot change the same object more than once without an intermediate point. (Note also that compilers are allowed to refuse to compile well-formed code that creates undefined behavior, which means that even the first pair may not be compiled).
AnT
source share