Actually the behaviour is undefined because you are accessing a variable (i) more than once between sequence points where one of those accesses modifies the value of the variable.
You do not know what order the 2 sub-expressions of the = operator are evaluated in, it is not specified in the standard.
Comment