October 2004
Intermediate to advanced
336 pages
6h 27m
English
This function sorts an array using the algorithm known as selection sort. The array is composed of elements of type int, holding a single integer. Because C has no way to determine the number of elements in an array, this is passed as a second argument to the function.
Selection sort uses two nested loops. The first time through the outer loop, the inner loop finds the element in the array that has the lowest number. It then swaps that element with the element in the first position in the array, so that the first element now has the lowest number in it. The outer loop then iterates again, finding the next lowest number in the array ...
Read now
Unlock full access