The behavior is undefined.
N1256 6.5p2:
Between the previous and next sequence point an object shall have its
stored value modified at most once by the evaluation of an expression.
Furthermore, the prior value shall be read only to determine the
value to be stored.
The program both modifies i[a]
(in i[a]++
) and reads its value (in the next argument), and the result of reading the value is not used to determine the value to be stored.
This is not just a matter of the unspecified order of evaluation of function arguments; the fact that there's no sequence point between i[a]++
and i[a]
(since that's not a comma operator) means that the behavior, not just the result, is undefined.