C Programming Absolute Beginner's Guide (3rd Edition)

(Romina) #1
FIGURE 23.1 During each pass, the lower values “float” to the top of the array.

The next program sorts a list of 10 numbers. The numbers are randomly generated using rand().
The bubble sort routine is little more than a nested for loop. The inner loop walks through the list,
swapping any pair of values that is out of order down the list. The outer loop causes the inner loop to

Free download pdf