October 2004
Beginner
408 pages
9h 24m
English
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.
Read now
Unlock full access