23. How Can I Arrange and Alphabetize?

The Bubble Sort Does the Trick

image

Sorting is the computer term given to ordering lists of values. Not only must you be able to find data in arrays, you often need to arrange array data in a certain order. Computers are perfect for sorting and alphabetizing data, and arrays provide the vehicles for holding sorted data.

Your programs don’t always hold array data in the order you want to see that data. For example, students don’t enroll in alphabetical last-name order, even though most colleges print lists of students that way. Therefore, ...

Get Absolute Beginner’s Guide to C, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.