What is wrong with my sorting function? I am trying to put numbers in ascending numbers.
I am confused now for I believe I have tried everything.Code:void sort(int array[], int numts) { int lowIndex, lowest; for (int count = 0; count < (numts-1); count++) { lowIndex = count; lowest = array[count]; for (int index = count + 1; index < numts; index++) { if (array[index] < lowest) { lowest = array[index]; lowIndex = index; } } array[lowIndex] = array[count]; array[count] = lowest; } return; }




Reply With Quote