These are built-in types that the C++ compiler implicitly understands. Some of the built-in types are -
- Booleans
- Characters
- Integers
- Single Precision Floats
- Double Precision Floats
- Void
Void Variables
No variable can be of type
void
; it is primarily used to indicate a function returning nothing. Avoid *
can point to any variable, and needs to be cast to another type before being dereferenced.
These fundamental types can further be modified using type specifiers. These set the size and the values allowed to be stored in these types.
short
long
unsigned
signed
Integer Overflow
Overflow behavior is well defined for
unsigned
integers (equivalent to the modulo operator or wrap around), but that’s not the case forsigned
integers. Also, conversion fromunsigned
tosigned
integers is well defined. The reverse is true from C++20.