Firstly, you should not write such code ....
But if we look at the issues, then it's simple: this is due to how the postfix operator "returns" a value. The postfix takes precedence over the assignment operator, but the postfix operator after increasing the value i returns the previous value i. So I reassign its previous value.
And again, do not use this construct in your code, since the next programmer who sees that this will happen after you (with something big in his hands) :)
Elister
source share