Let's have an array a = {0,1,2,3,4} and an int i = 2. Now let's do few operations in both (always starting from the point above).
a[i] = i++; // a = {0, 1, 2, 3, 4}
a[i] = ++i, // a = {0, 1, 3, 3, 4}
This seems logical to me. But for C++, I get different results:
a[i] = i++; // a = {0, 1, 2, 2, 4}
a[i] = ++i; // a = {0, 1, 2, 3, 4}
I don't understand the results I get in C++;