From the course: C: Data Structures, Pointers, and File Systems

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Challenge: Presidents of the U.S.A.

Challenge: Presidents of the U.S.A. - C Tutorial

From the course: C: Data Structures, Pointers, and File Systems

Start my 1-month free trial

Challenge: Presidents of the U.S.A.

(upbeat music) - [Instructor] For this chapter's challenge you are to construct an array of structures. The array has four elements, four structures. You are to display the four structures, then you're to swap two elements in the array, and then display the four structures again. Now, to pull off this challenge, you'll need to define two structures. The first is a person structure. It contains two members, a character array name, which is a string of 32 characters, and a second member, date, which is called tookoffice. This structure has three integer members, month, day, and year. What you're cobbling together here is this data, the four US presidents who appear on the Mount Rushmore monument, Washington, Jefferson, Lincoln, and Roosevelt, along with the date they took office, which is shown here. Again, the code you create to solve this challenge takes the data provided, which I'll show again, and it puts it into an array of person structures named president. The code then displays…

Contents