C++: The Complete Reference
represented either by variables or by constants. Like most other computer languages,
C/C++ supports a number of different types of data. It also provides a wide variety of
operators.
floating-point, and valueless (char, int, float, double, and void, respectively). As you
will see, all other data types in C are based upon one of these types. The size and range
of these data types may vary between processor types and compilers. However, in all
cases a character is 1 byte. The size of an integer is usually the same as the word length
of the execution environment of the program. For most 16-bit environments, such as
DOS or Windows 3.1, an integer is 16 bits. For most 32-bit environments, such as
Windows NT, an integer is 32 bits. However, you cannot make assumptions about
the size of an integer if you want your programs to be portable to the widest range of
environments. It is important to understand that both C and C++ only stipulate
the minimal range of each data type, not its size in bytes.
These are discussed in Part Two.
host computer. Values of type char are generally used to hold values defined by the
ASCII character set. Values outside that range may be handled differently by different
compilers.
C specifies that the minimum range for a floating-point value is 1E
Table 2-1.
it simply states that they must meet certain requirements. For example, Standard
C++ states that an int will "have the natural size suggested by the architecture of
the execution environment." In all cases, this will meet or exceed
the minimum ranges specified by Standard C. Each C++ compiler specifies the size
and range of the basic types in the header <climits>.