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. - C Tutorial
From the course: C: Data Structures, Pointers, and File Systems
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Understanding arrays2m 59s
-
(Locked)
Working with arrays3m 5s
-
(Locked)
Modifying arrays3m 11s
-
(Locked)
Passing an array to a function3m 17s
-
(Locked)
Working multi-dimensional arrays3m 2s
-
(Locked)
Building a structure3m 23s
-
(Locked)
Nesting structures2m 56s
-
(Locked)
Creating an array of structures2m 28s
-
(Locked)
Sending a structure to a function3m 36s
-
(Locked)
Understanding a union2m 47s
-
(Locked)
Challenge: Presidents of the U.S.A.1m 38s
-
(Locked)
Solution: Presidents of the U.S.A.2m 52s
-
-
-
-
-
-