// Source: "Software Design ...", John A Robinson, Newnes, 2004, page 228. int sort(int array[], const int num_in_array) { int i, j, temp, current; for (i = 1; i < num_in_array; i++) { current = array[i]; for (j = i-1; j >= 0; j--) { if ((temp = array[j]) <= current) break; // out of the inner for loop array[j+1] = temp; } array[j+1] = current; } return(0); }