O'Reilly logo

C by Nikolaos D. Tselikas, George S. Tselikis

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

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 ...

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