sizeof operator in C++ is an unary operator which can be used to find the size of the data-type or expression or a variable.
It returns the size of the memory allocated (in Bytes) by the compiler. Lets say, we want to find the size of the memory allocated to the data-type
int. We can find it by using
sizeof operator as shown in the below code:
sizeOfInt = sizeof(int);
cout << sizeOfInt << " Bytes";
As you can see, the above code calculated the size of int data type and displayed the result in C++.