Hey there! in this post we are going to talk about fundamental types in C++.
Any value we use in our code, requieres a space in the computers memory. What the computer need to know to run the program correctly is how much space need the value and how to read it.
Here is a table with the fundamental types used in C++. The most common used are char, float, (signed) int double (float), bool and void.
Check it, and I hope it helps you.
Group | Type names* | Notes on size / precision |
---|---|---|
Character types | char |
Exactly one byte in size. At least 8 bits. |
char16_t |
Not smaller than char . At least 16 bits. |
|
char32_t |
Not smaller than char16_t . At least 32 bits. |
|
wchar_t |
Can represent the largest supported character set. | |
Integer types (signed) | signed char |
Same size as char . At least 8 bits. |
signed short int |
Not smaller than char . At least 16 bits. |
|
signed int |
Not smaller than short . At least 16 bits. |
|
signed long int |
Not smaller than int . At least 32 bits. |
|
signed long long int |
Not smaller than long . At least 64 bits. |
|
Integer types (unsigned) | unsigned char |
(same size as their signed counterparts) |
unsigned short int |
||
unsigned int |
||
unsigned long int |
||
unsigned long long int |
||
Floating-point types | float |
|
double |
Precision not less than float |
|
long double |
Precision not less than double |
|
Boolean type | bool |
|
Void type | void |
no storage |
Null pointer | decltype(nullptr) |
Mastery 09 – Basic types and their use in C++ by Juan Pablo Santana is licensed under a Creative Commons Attribution 4.0 International License.