size of Operator in c++




This video tutorial explains the size of operator in c++.
You will learn what is the use of size of operator, how to use size of with data types, variables and structures in detail with example.

source code for this tutorial

#include <iostream>

using namespace std;

struct student{
int rollno;
char sex;
};

int main()
{
    int age;
    cout << " int --> "<<sizeof(age)<<endl;
    cout << " short int --> "<<sizeof(short int)<<endl;
    cout << " char --> "<<sizeof(char)<<endl;
    cout << " float --> "<<sizeof(float)<<endl;
    cout << " struct student --> "<<sizeof(student)<<endl;

    return 0;
}