Chapter 2. Variables and Basic Types
Contents
- Section 2.1 Primitive Built-in Types
 - Section 2.2 Variables
 - Section 2.3 Compound Types
 - Section 2.4 
constQualifier - Section 2.5 Dealing with Types
 - Section 2.6 Defining Our Own Data Structures
 - Chapter Summary
 - Defined Terms
 
Types are fundamental to any program: They tell us what our data mean and what operations we can perform on those data.
C++ has extensive support for types. The language defines several primitive types (characters, integers, floating-point numbers, etc.) and provides mechanisms that let us define our own data types. The library uses these mechanisms to define more complicated types such as variable-length character strings, vectors, and so on. This chapter covers the built-in types and begins our coverage of how C++ supports more complicated types.
Types determine the meaning of the data and operations in our programs. The meaning of even as simple a statement as
i = i + j;depends on the types of i and j. If i and j are integers, this statement has the ordinary, arithmetic meaning of +. However, if i and j are Sales_item objects (ยง 1.5.1, p. 20), this statement adds the components of these two objects.