Data Analysis questions

I think there is a problem with the above code section where you check if j is greater or equal to the arraysize and then a couple of lines later index the a[] array with j.

Doesn't j need to be reset if equal to or greater than the arraysize?