Sunday, April 19, 2015

C++ Programming

Use of sizeof()

This function is used for finding the size of any variable include array ,structure and class .

Syntax:

if we want to find the size of integer variable :

int a,b;
b=10;
a=sizeof(b);
cout<< b <<endl ;

or
cout <<sizeof(b)<<endl;

if we want to find the size of general data type :

cout<<sizeof(int)<<endl;
cout<<sizeof(float)<<endl;
cout<<sizeof(bool)<<endl;