++a = b operation is showing no error but a++ = b is showing error while compiling with g++. Both the variable are initialized before these operations.
Although these operation have no practical usage I think both of them should issue the same error while compiling. What do you think? If there is a valid reason kindly explain to me. Thanks in advance! 🙂
P.S. gcc gives error on both of these.
Let see how declarations of pre/post-increment look like ( http://en.cppreference.com/w/cpp/language/operator_incdec ):
And you’ve got the answer – preInc returns reference, so you can override “a” variable using “=” operator.