Davey Lopez wrote:can anyone just tell me if I got my assumption about x[j+1]=x[j]; correct?
Davey Lopez wrote:from what i can gather it is taking j's value which is 9 and adding 1 to it but that doesn't make sense to me. I do understand that the j-- is simply subtracting 1 to set up the next comparison in the array
No, that is not exactly correct. j is an INDEX into an array. It is keeping track of where you are in the array. So j's value is not 9. j's value is 3. so x[j] means the value at j'th position in the array - that is your 9.
so x[J+1] is the "j+1th" element in the array, or position 4. so we put the value at position three (9) into the slot at position 4, overwriting the value of 4.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors