ProAnswers.org

Why doesn’t this code: a[i] = i++; work?

The subexpression i++ causes a side effect.it modifies i’s value.which leads to undefined

behavior since i is also referenced elsewhere in the same expression.