#C++ #C_language #programming_in_C_C++
C / C++ Data Types
In this tutorial, we will learn about basic data types such as int, float, char, etc. in C++ programming with the help of examples.
In C++, data types are declarations for variables. This determines the type and size of data associated with variables. For example,
C++ int
The int keyword is used to indicate integers.
Its size is usually 4 bytes. Meaning, it can store values from -2147483648 to 2147483647.
C++ float and double
float and double are used to store floating-point numbers (decimals and exponentials).
The size of float is 4 bytes and the size of double is 8 bytes. Hence, double has two times the precision of float
C++ char
Keyword char is used for characters.
Its size is 1 byte.
Characters in C++ are enclosed inside single quotes ' '
C++ wchar_t
Wide character wchar_t is similar to the char data type, except its size is 2 bytes instead of 1.
It is used to represent characters that require more memory to represent them than a single char
C++ void
The void keyword indicates an absence of data. It means "nothing" or "no value".
We will use void when we learn about functions and pointers.
unsigned int 4 can only store positive integers