To verify that the prefix operator returns an lvalue I ran this C++ code:
int i = 2;
++i = 4;
cout << i;
This compiles without any error.
Now I’m curious whether this code is undefined or not, since order of evaluation is undefined for =
I searched for similar questions in stack overflow, but didn’t find any which had an increment/decrement on the lhs of the assignment operator.
New contributor
AverageStudent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.