Data Types

The C language includes a variety of data types. The ANSI C Standard groups these data types into a number of different categories. For example, the C data types are divided into three general categories.

  • An object type describes an object.
  • A function type describes a function by specifying the return type, and the number and types of its parameters.
  • An incomplete type describes an object but lacks the information needed to determine the object's size.

This chapter focuses on object types. Chapter 6 explains function types. The "Incomplete Types" section in Chapter 3 explains incomplete types.

This chapter's discussion of data types concentrates on the range of values that can be stored in and the allocation of each data type. It also explains the set of type-related operations allowed with each data type and any VOS C extensions or restrictions. It does not explain those operations, such as the sizeof and address-of (&) operation, that can be applied to any object operand. The last section in this chapter contains a summary of the VOS C data types.

See Chapter 7 for detailed information on each operator.

Figure 4-1 shows the scalar and aggregate types.

A scalar type is a type that holds a single data object and yields a single value. In VOS C, the scalar types consist of the arithmetic types, pointer types, and the varying-length character string (char_varying) type. As shown in Figure 4-1, the arithmetic types consist of the integral and floating-point types.

An aggregate type is a type that consists of an ordered collection of data objects. The aggregate types consist of the array and structure types.

Figure 4-1. Scalar and Aggregate Types

In addition to the scalar and aggregate type categories, the C language has function types, union types, and the void type. Chapter 3 contains information on how you declare and initialize variables of each data type.