2.1 Data Types Notes PDF
2.1 Data Types Notes PDF
int a=2;
int Integer 4
float Floating-point 4
char Character 1
bool Boolean 1
void Empty 0
1. int
This data type is used to store integers.
It occupies 4 bytes in memory.
It can store values from -2147483648 to 2147483647.
Eg. int age = 18
3. char
This data type is used to store characters.
It occupies 1 byte in memory.
Characters in C++ are enclosed inside single quotes .
ASCII code is used to store characters in memory.
Eg char ch a
4. bool
This data type has only 2 values true and false.
It occupies 1 byte in memory.
True is represented as 1 and false as 0.
Eg. bool flag = false
C++ Type Modifiers
Type modifiers are used to modify the fundamental data types.
long long int 8 used for very large integers (equivalent to long
long int).
unsigned long 8 used for very large positive integers or 0
long (equivalent to unsigned long long int)
These are the data types that are defined by user itself.
For example, class, structure, union, enumeration, etc.
We will be studying the derived and user-defined data types in detail in the
further video lectures.