O'Reilly logo

C Programming: Visual Quickstart Guide by Marc Liyanage, Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introduction to Structures

Structures are not a data type in themselves but rather a way for you to define your own data type. Moreover, with structures you can better model real-world objects. For example, if you wanted to create a list of books, storing the author, publication date, and title of each, you could do that with arrays: one array for the authors, one for the publication years, and a third for the titles (Figure 13.1). But such a construct would be less than ideal, at the very least because the three arrays would be seemingly unrelated. A better solution is to create one type of variable that can store the author's name, the title, and the publication date, all under one umbrella. This is where structures come in.

Figure 13.1. Using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required