Chapter 13
Structures and Unions
This chapter introduces two new types: structures and unions. Like arrays, structures and unions aggregate a set of values into a single entity. However, their properties are quite different from an arrayâs. Unlike arrays, the elements of a structure or union may have different types. Furthermore, to access a member of a structure or union, we specify its name, and not its position as an integer subscript. This chapter discusses how to define structures and unions types, declare variables, and perform operations on them.
Structures
When we want to group related data items within a single entity, a structure is a typical choice. For example, a structure may hold information for a company, such as its name, business ...
Get C 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.