Chapter 18Programming Problems Using Structure

DOI: 10.1201/9781003257981-18

18.1 Sort a Person Database

This program sorts a database of people. Each person is an object with two attributes: name and age. The program sorts the people by ages or by names. The database is a text file containing two columns: age and name. A few lines of the database are shown below:

This is the header file of the Person structure and the PersonDatabase structure.

Get Intermediate C Programming, 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.