Chapter 4 Basic Data Types
Each piece of data in a computer program has a data type, which specifies:
its possible values,
the bit patterns used to represent those values,
operations that can be performed on the data, and
its meaning.
Some programming languages require the programmer to explicitly state the data types of values used in the program. Examples are C, C++, and Java. Other languages, for example, Python, BASIC, can determine a data type from how the value is used. CPU architectures specify machine-level data types, often including specialized data types that are unique to that particular architecture.
In this chapter we study the relationship between the C/C++ integer, int
, and character, char
, data types. Composite data types are discussed in Chapter 15, and the float
data type is discussed in Chapter 16.