Data types define the type of data a variable can hold, for example an integer variable can hold integer data, a character type variable can hold character data, the float data type stores double-precision floating-point numbers with up to 17 significant digits etc.

Data types in C++ are categorised in three groups: Built-inuser-defined and Derived.



Built in data types

char: For characters. Size 1 byte.

char ch = 'A';

int: For integers. Size 2 bytes.

int num = 10;

float: For single precision floating point. Size 4 bytes.

float num = 163.77457;

double: For double precision floating point. Size 8 bytes.

double num = 15348.98452;

bool: For booleans, true or false.

bool b = true;


wchar_t: Wide Character. This should be avoided because its size is implementation defined and not reliable.

User-defined data types

We have three types of user-defined data types in C++

1. struct
2. union
3. enum

I have covered details in separate tutorials. For now just remember these are under user-defined data types.

Derived data types in C++

We have three types of derived-defined data types in C++

1. Array
2. Function
3. Pointer

They are Large topics of C++ and I have covered in separate tutorials. Just follow the tutorials.