sizeof() i C++ :
-This is the function that return the size of the any data_type.
syntax:
sizeof(variable);
Example-
sizeof(int) //4
sizeof(char) //1
program:
#include < iostream>
using namespace std;
int main()
{
int num;
char s='2';
float k=3.21;
double d=2.897;
cout<<"Size of int: "<< sizeof(num)<< endl;
cout<<"Size of char: "<< sizeof(s)<< endl;
cout<<"Size of float: "<< sizeof(k)<< endl;
cout<<"Size of double: "<< sizeof(d)<< endl;
return 0;
}
Size of int: 4
Size of char: 1
Size of float: 4
Size of double: 8