Void type
- void - type with an empty set of values. It is an incomplete type that cannot be completed (consequently, objects of type
voidare disallowed). There are no arrays of
void, nor references to
void. However, pointers to
voidand functions returning type
void(procedures in other languages) are permitted.
 Boolean type
- bool - type, capable of holding one of the two values: true or false.
 Character types
- signed char - type for signed character representation.
- unsigned char - type for unsigned character representation. Also used to inspect object representations (raw memory).
- char - type for character representation which can be most efficiently processed on the target system (equivalent to either signed char or unsigned char, but still different type). The character types are large enough to represent 256 different values (in order to be suitable for storing UTF-8 encoded data) (since C++14)
- wchar_t - type for wide character representation
 Integer types
- int - basic integer type. They keyword
intmay be omitted if any of the modifiers listed below are used. If no length modifiers are present, guaranteed to have width of at least 16 bits. However, on 32/64 bit systems it is almost exclusively guaranteed to have width of at least 32 bits (see below).
Modifies the integer type. Can be mixed in any order. Only one of each group can be present in type name.
- signed - target type will have signed representation (this is the default if omitted)
- unsigned - target type will have unsigned representation
- short - target type will be optimized for space and will have width of at least 16 bits.
- long - target type will have width of at least 32 bits.
The following table summarizes all available integer types and their properties:
|Type specifier||Equivalent type||Width in bits by data model|
|short int|| at least
signed short int
|unsigned short int|
unsigned short int
|int|| at least
|long int|| at least
signed long int
|unsigned long int|
unsigned long int
| long long int
| at least
long long int
signed long long
signed long long int
unsigned long long
| unsigned long long int |
unsigned long long int
Besides the minimal bit counts, the C++ Standard guarantees that
- 1 == sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long).
Note: this allows the extreme case in which bytes are sized 64 bits, all types (including char) are 64 bits wide, and sizeof returns 1 for every type.
 Data models
The choices made by each implementation about the sizes of the fundamental types are collectively known as data model. Four data models found wide acceptance:
32 bit systems:
- LP32 or 2/4/4 (int is 16-bit, long and pointer are 32-bit)
- Win16 API
- ILP32 or 4/4/4 (int, long, and pointer are 32-bit);
- Win32 API
- Unix and Unix-like systems (Linux, Mac OS X)
64 bit systems:
- LLP64 or 4/4/8 (int and long are 32-bit, pointer is 64-bit)
- Win64 API
- LP64 or 4/8/8 (int is 32-bit, long and pointer are 64-bit)
- Unix and Unix-like systems (Linux, Mac OS X)
Other models are very rare. For example, ILP64 (8/8/8: int, long, and pointer are 64-bit) only appeared in some early 64-bit Unix systems (e.g. Unicos on Cray).
 Floating point types
- float - single precision floating point type. Usually IEEE-754 32 bit floating point type
- double - double precision floating point type. Usually IEEE-754 64 bit floating point type
- long double - extended precision floating point type. Does not necessarily map to types mandated by IEEE-754. Usually 80-bit x87 floating point type on x86 and x86-64 architectures.
|This section is incomplete|
Reason: more details here?
 Range of values
The following table provides a reference for the limits of common numeric representations. As the C++ Standard allows any signed integer representation, the table gives both the minimum guaranteed requirements (which correspond to the limits of one's complement or sign-and-magnitude) and the limits of the most commonly used implementation, two's complement. All popular data models (including all of ILP32, LP32, LP64, LLP64) use two's complement representation, though.
|Type||Size in bits||Format||Value range|
|character||8||signed (one's complement)||-127 to 127(until C++14)|
|signed (two's complement)||-128 to 127|
|unsigned||0 to 255|
|integral||16||signed (one's complement)||± 3.27 · 104||-32767 to 32767|
|signed (two's complement)||-32768 to 32767|
|unsigned||0 to 6.55 · 104||0 to 65535|
|32||signed (one's complement)||± 2.14 · 109||-2,147,483,647 to 2,147,483,647|
|signed (two's complement)||-2,147,483,648 to 2,147,483,647|
|unsigned||0 to 4.29 · 109||0 to 4,294,967,295|
|64||signed (one's complement)||± 9.22 · 1018||-9,223,372,036,854,775,807 to 9,223,372,036,854,775,807|
|signed (two's complement)||-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807|
|unsigned||0 to 1.84 · 1019||0 to 18,446,744,073,709,551,615|
|32||IEEE-754|| ± 3.4 · 10± 38
|64||IEEE-754|| ± 1.7 · 10± 308