Well it is valid, but it’s ugly.
array[i]++;
would just increment whatever is the i’th element of array.
The loop will increment the first four elements of array but will break if one of them is 99.
you’ve seen something that looks like array[i]++ in the line below it (…in case you haven’t, ‘++’ is called the post-increment operator, and just adds one to the expression immediately before it). What matters is the order of evaluation of expressions. The array operator, ‘[]’, has a higher priority than the post-increment operator and so is evaluated first, referencing the ith value of the array. Then the post-increment adds one to it.
This is equivalent to the following:
a = array[i];
a = a + 1;
array[i] = a;
Without seeing the code in context it’s hard to know what exactly it is that it’s trying to do.