What this C++ increment operator question tests
This is a straightforward easy language-knowledge question that probes whether a candidate understands the precise semantics of the increment operator in C++. It rewards careful reading of operator behaviour and awareness of undefined behaviour in the language.
To reason through problems like this, you need to know the difference between pre-increment and post-increment, understand evaluation order and sequencing rules, and recognize when the standard permits or forbids certain expressions. Getting the answer right depends on reading the C++ standard carefully rather than intuition or guessing based on compiler output.
- Pre-increment vs. post-increment semantics
- Sequence points and the rules governing multiple modifications
- Undefined behaviour in C++