Dafination of Datatype :
A datatype defines the type of data a variable will store in memory. we will discuss all datatype in C++ language.
we will use data type for declaring variables. and if you want to check the datatype size then you can use sizeOf() function in C++.

Syntax :
datatype_name variable_name =Â value;
datatype_name : name of datatype
variable_name: name of a variable.
value: the value of a variable that you want to assign.
Example :
int xyz = 0;

there are Three types of datatype in C++.
- Pre-define datatype (in-Built)
- User-define datatype
- Derived datatype
1) Pre-define Datatype
predefine datatype is an in-Built datatype. They specify the size of variables in C++. There are many pre-defined datatypes in c++.
Datatype Name | Size | Capacity |
---|---|---|
int | 2 Bytes | -32768 to +32767 |
signed int | 2 Bytes | -32768 to +32767 |
unsigned int | 2 Bytes | 0 to +32767 |
short int | 2 Bytes | -32768 to +32767 |
unsigned short int | 2 Bytes | 0 to +65535 |
Long int | 4 Bytes | -2147483648 to +2147483647 |
unsigned long int | 4 Bytes | 0 to +4294967295 |
Also Read This :- static member function in c++ .
Datatype Name | Size | Capacity |
---|---|---|
float | 4 Bytes | 3.4 E-38 to 3.4 E+38 |
double | 8 Bytes | 1.7 E-308 to 1.7 E+308 |
long double | 10 Bytes | 3.4 E-4532 to 1.1 E+4932 |
Datatype Name | Size | Capacity |
---|---|---|
char | 1 Bytes | -128 to +127 |
unsigned char | 1 Bytes | 0 to 255 |
User Define Datatype
A data type that is defined by the user it is called user define datatype in C++. Users can create a datatype using the below datatype.
User define Datatype |
---|
structure |
union |
class |
enumerate |
Derived Datatype
Derived datatype is a collection of pre-defined data types. The array is the most useful derived datatype in C++.
Derived define Datatype |
---|
Array |
Function |
Pointer |
Refrence |