Previous Page
Next Page

2.1. Typology

The types in C can be classified as follows:

  • Basic type

    • Standard and extended integer types

    • Real and complex floating-point types

  • Enumerated types

  • The type void

  • Derived types

    • Pointer types

    • Array types

    • Structure types

    • Union types

    • Function types

The basic types and the enumerated types together make up the arithmetic types . The arithmetic types and the pointer types together are called the scalar types . Finally, array types and structure types are referred to collectively as the aggregate types . (Union types are not considered aggregate, because only one of their members can store a value at any given time.)

A function type describes the interface to a function; that is, it specifies the type of the function's return value, and may also specify the types of all the parameters that are passed to the function when it is called.

All other types describe objects. This description may or may not include the object's storage size: if it does, the type is properly called an object type ; if not, it is an incomplete type . An example of an incomplete type might be an externally defined array variable:

    extern float fArr[ ];     // External declaration

This line declares fArr as an array whose elements have type float. However, because the array's size is not specified here, fArr's type is incomplete. As long as the global array fArr is defined with a specified size at another location in the programin another source file, for examplethis declaration is sufficient to let you use the array in its present scope. (For more details on external declarations, see Chapter 11.)

This chapter describes the basic types, enumerations and the type void. The derived types are described in Chapters 7 through 10.

Some types are designated by a sequence of more than one keyword, such as unsigned short. In such cases, the keywords can be written in any order. However, there is a conventional keyword order, which we use in this book.

Previous Page
Next Page