You filled only 9 elements of the array but call selectionSort specifying ArrayMax which is equal to 1000.
selectionSort(y, ArrayMax);
So you sort entered values mixed with non-initialized elements of the array.
You should call selectionSort specifying actual number of elements which get their values.
Last edited on