C++ Programming Blog

 
 
 

Image

 #include<iostream.h>
 #include<conio.h>

 main( )
    {
       clrscr( );

       int i=5;

       float f=3.3;

       char c=\'M\';

       cout<<\"\\n *********  Values stored in the  Variables  ********\"<<endl;
       cout<<\"\\t Value of i = \"<<i<<endl;
       cout<<\"\\t Value of f = \"<<f<<endl;
       cout<<\"\\t Value of c = \"<<c<<endl;

       cout<<\"\\n *********  Sizes of the Variables  ********\"<<endl;
       cout<<\"\\t Size of i = \"<<sizeof(i)<<endl;
       cout<<\"\\t Size of f = \"<<sizeof(f)<<endl;
       cout<<\"\\t Size of c = \"<<sizeof(c)<<endl;

       cout<<\"\\n *********  Addresses of the Variables  ********\"<<endl;
       cout<<\"\\t Address of i = \"<<&i<<endl;
       cout<<\"\\t Address of f = \"<<&f<<endl;
       cout<<\"\\t Address of c = \"<<&c<<endl;

       cout<<\"\\n *********  Sizes of the Data types  ********\"<<endl;
       cout<<\"\\t Size of int = \"<<sizeof(int)<<endl;
       cout<<\"\\t Size of float = \"<<sizeof(float)<<endl;
       cout<<\"\\t Size of char = \"<<sizeof(char)<<endl;

       getch( );
       return 0;
    }