A SIMPLE EXCHANGE SORT ALGORITHM
The following steps define an algorithm for sorting an array,
1. Set i to 0 2. Set j to i + 1 3. If a[i] > a[j], exchange their values 4. Set j to j + 1. If j < n goto step 3 5. Set i to i + 1. If i < n - 1 goto step 2 6. a is now sorted in ascending order. Note: n is the number of elements in the array.
Implement the above algorithm as a function in C, accepting the array and its size, returning the sorted array in ascending order so it can be printed out by the calling module. The array should consist of ten elements.
ęCopyright B Brown. 1984-1999. All rights reserved.