Aggregate Data Types

This section describes aggregate data types, which contain organized collections of data in a definite order. In C, the aggregate types are arrays, structures, and unions.

An “array” is a collection of data items of the same type. Programs use arrays in cases where a standard data format is repeated many times. For example, you might use an array to store numbers representing the population of Minnesota for all the years from 1950 to 2000. C-language arrays are very similar to arrays in QuickPascal and QuickBasic.

A “structure” is a collection of data items of different types. Programs use structures in cases where a variety of data have a close association. For example, you might use a structure to store information about a given employee—name, months of employment, and hourly wage. Structures are similar to QuickPascal records or QuickBasic user-defined types.

A “union” allows you to use different data formats to access the same area of memory. It can hold different kinds of information at different times. Unions are similar to variant records in QuickPascal.