Chapter 7

User-Defined Data Types

In this chapter, we discuss several new data types that are available in C. These data types are convenient to handle and simplify the programming task.

7.1 | STRUCTURES

Consider that we want to write a program where we need to keep a group of dissimilar data items together. The techniques discussed so far are inapplicable in this regard. Arrays cannot achieve the purpose since an array requires all the items stored in it to be of the same data type. In this situation, we would use C structures to keep the group of dissimilar data items under a single composite variable. Thus, in contrast to arrays, a structure is used to represent a collection of data items, possibly of different data types, by a single name. ...

Get C Programming Essentials 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.