Today I will write about the basic types in c++. First of all, what is a type? According to Allen B. Downey, a type is a set of values. The fundamental c++ types are the following:
Void
It is an empty set of values. It is an incomplete type that cannot be completed.
Bool
It can hold one of two values: true and false.
Character types
Signed char- signed character representation.
Unsigned char- unsigned character representation.
Char- character representation.
Wchar_t- wide character representation.
Int
It is the basic integer type.
Floating point types
Float- single precision floating point type.
Double- double precision floating point type.
Long double- extended precision floating point type.
Reference: http://en.cppreference.com/w/cpp/language/types
Here’s a poem about basic c++ types done by me:
Villain’s heart’s empty, just as void,
while bool need no justification,
just a true or false coin.
There are the character types,
each one for a different occasion;
First there’s simple char,
where characters representation
we can find;
Then, there’s signed and unsigned,
which need no further explanation;
And finally, there’s wchar_t,
where double u stands for wide.
Meanwhile, the int type can’t lie
since only integer numbers we should try.
There are floating point types too,
float is a single precision,
and there’s double if you’re thinking by two,
Also there’s long double allowing extension.
Remember all basic types,
and no problems for you!
Basic types and their use in c++ by Mferflores is licensed under a Creative Commons Attribution 4.0 International License.