[go: up one dir, main page]

0% found this document useful (0 votes)
6 views2 pages

6 Data Types

The document provides a comprehensive list of fundamental data types in C++, categorized into character types, signed integer types, unsigned integer types, floating-point types, boolean type, void type, and null pointer. It includes details on the size, precision, and range of each type, highlighting that larger types can represent more distinct values but also consume more memory. Additionally, it specifies the number of unique representable values for different bit sizes.

Uploaded by

Jordi Puig
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

6 Data Types

The document provides a comprehensive list of fundamental data types in C++, categorized into character types, signed integer types, unsigned integer types, floating-point types, boolean type, void type, and null pointer. It includes details on the size, precision, and range of each type, highlighting that larger types can represent more distinct values but also consume more memory. Additionally, it specifies the number of unique representable values for different bit sizes.

Uploaded by

Jordi Puig
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 2

Here is the complete list of fundamental types in C++:

Notes on size /
Group Type names*
precision
Exactly one byte in
char
size. At least 8 bits.
Not smaller than char.
char16_t
At least 16 bits.
Character types Not smaller than
char32_t char16_t. At least 32
bits.
Can represent the
wchar_t largest supported
character set.
Same size as char. At
signed char
least 8 bits.
Not smaller than char.
signed short int
At least 16 bits.
Not smaller than
Integer types (signed) signed int
short. At least 16 bits.
Not smaller than int.
signed long int
At least 32 bits.
Not smaller than long.
signed long long int
At least 64 bits.
unsigned char
unsigned short int
Integer types unsigned int (same size as their
(unsigned) unsigned long int signed counterparts)
unsigned long long
int
float
Precision not less than
double
Floating-point types float
Precision not less than
long double
double
Boolean type bool
Void type void no storage
Null pointer decltype(nullptr)

Type sizes above are expressed in bits; the more bits a type has, the more
distinct values it can represent, but at the same time, also consumes
more space in memory:
Unique
Size representable Notes
values
8-bit 256 = 28
16-bit 65 536 = 216
32-bit 4 292 967 296 = 232 (~4 billion)
18 446 744 073 309 = 264 (~18 billion
64-bit 551 616 billion)

http://stackoverflow.com/questions/589575/what-does-the-c-standard-state-the-size-
of-int-long-type-to-be

1 signed char: -127 to 127 (note, not -128 to 127; this


accommodates 1's-complement platforms)
2 unsigned char: 0 to 255
3 "plain" char: -127 to 127 or 0 to 255 (depends on default
char signedness)
4 signed short: -32767 to 32767
5 unsigned short: 0 to 65535
6 signed int: -32767 to 32767
7 unsigned int: 0 to 65535
8 signed long: -2147483647 to 2147483647
9 unsigned long: 0 to 4294967295
10 signed long long: -9223372036854775807 to
9223372036854775807
11 unsigned long long: 0 to 18446744073709551615

You might also like