int *select_sort(int *a, int length){ for (int i = 0; i < length; i++) { int min_value_index = i; for (int j = i + 1; j < length; j++) { // select the min value index and record it if (a[min_value_index] > a[j]) { min_value_index = j; } } if (min_value_index != i) { int temp = a[min_value_index]; a[min_value_index] = a[i]; a[i] = temp; } // print(a, length); } return a; }