posted 6 years ago
Ok, so the idea is to find an specific numer in a given array, change it to a zero and change the index so it is the last element in the array.
All the other elements should then move so their index = index -1
So this is what I've got so far:
This changes the numbers for instance 3 into 0 and puts them in the back of the array but the output is wrong
Output:
4, 8, 2, 5, 5, 17, 7, 99, 0, 0
I can't seem to find the problem though. Can anybody help or give a hint where I am going wrong here?
Thanks in advance.