Program to illustrate the use of sizeof operator


     # include <iostream.h>
     int main( )
     {       
    // Prints the storage sizes of the fundamental types :
    cout << "Number of Bytes used :\n";
    cout <<"\t char : "<< sizeof(char)<<endl;
    cout <<"\t short: "<< sizeof(short)<<endl;
    cout <<"\t long : "<< sizeof(long)<<endl;
    cout <<"\t unsigned char : "<< sizeof(unsigned char)<<endl;
    cout <<"\t unsigned short  : "<< sizeof(unsigned short)<<endl;
    cout <<"\t unsigned int  : "<< sizeof(unsigned int )<<endl;
    cout <<"\t unsigned long  : "<< sizeof(unsigned long )<<endl;   
    cout <<"\t signed char : "<< sizeof(signed char)<<endl;
    cout <<"\t float : "<< sizeof(float)<<endl;
    cout <<"\t double : "<< sizeof(double)<<endl;
    cout <<"\t long double : "<< sizeof(long double)<<endl;
              return 0;
      }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|