This is due to the order of operations regarding the prefix and the postfix versions of the incremental operator. The second example says to dereference then increment after assignment which puts us at the second position in the array for the number 20. The third example says to increment then dereference which puts at position three for the assignment of number 20 but that gets overwritten with number 30 in the next operation.