Multiple preincrement operations on a variable in C++(C ?)
问题 Why does the following compile in C++? int phew = 53; ++++++++++phew ; The same code fails in C, why? 回答1: That is because in C++ pre-increment operator returns an lvalue and it requires its operand to be an lvalue . ++++++++++phew ; in interpreted as ++(++(++(++(++phew)))) However your code invokes Undefined Behaviour because you are trying to modify the value of phew more than once between two sequence points. In C , pre-increment operator returns an rvalue and requires its operand to be an