If the initial value of i is 2 What is the value of expression i++ + i++?
It’s undefined. Both in C & in C++.
The standard says:
So you should never do that 🙂
Another example is:
arr[i] = i++;
More undefined behavior: In the below example also, the values passed to the function are not defined irrespective to the value of i.
fun(arr[i], i++);
Here, the result is undefined because the order of evaluation of function arguments is undefined