How To Use sizeof an Operator in C++
Master C++ with Real-time Projects and Kickstart Your Career Start Now!!
Program 1
// Program for Sizeof Operator
#include<iostream>
#define clrscr() system("cls")
using namespace std;
class Test1
{
private:
double d1;
double d2;
double d3;
int n;
};
class Test2:public Test1
{
};
int main()
{
clrscr();
Test1 T1;
Test2 T2;
cout<<"size of class Test1 : "<<sizeof(T1);
cout<<"\nsize of class Test2 : "<<sizeof(T2);
// int a=34;
// cout<<"\nsize of integer "<<sizeof(a);
// cout<<"\nsize of double "<<sizeof(34.67);
// cout<<"\nsize of float "<<sizeof(34.67f);
// cout<<"\nsize of char "<<sizeof('y');
return 0;
} You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

