8. Working with Structures

Chapter 6, “Working with Arrays,” introduced the array that permits you to group elements of the same type into a single logical entity. To reference an element in the array, all that is necessary is that the name of the array be given together with the appropriate subscript.

The C language provides another tool for grouping elements together. This falls under the name of structures and forms the basis for the discussions in this chapter. As you will see, the structure is a powerful concept that you will use in many C programs that you develop.

This chapter will introduce several key aspects of structures, including

Defining structures

Passing structures to functions

Arrays of structures

Structures of arrays

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