Solution:NIIT/GNIIT Sonugiri0032@gmail.com

Wednesday, January 06, 2016

Data Types with sizes

Data Types with sizes

Structure of the Problem Requirements 

The Data types size may be differ according to your system and compiler that you used for coding . In this program we first declare all these data types with simple variable name and after this pass this variable to C++ size of function .

Source Code

#include <iostream>
using namespace std;

int main()
{
   char a;
   int b;
   short int c;
   long int d;
   float e;
   double f;
   wchar_t g;
   cout<<" \t \t \t Size of Different Data Types ";
   cout<<endl;
   cout << " The Size of char      : " << sizeof(a) << endl;
   cout << " The Size of int       : " << sizeof(b) << endl;
   cout << " The Size of short int : " << sizeof(c) << endl;
   cout << " The Size of long int  : " << sizeof(d) << endl;
   cout << " The Size of float     : " << sizeof(e) << endl;
   cout << " The Size of double    : " << sizeof(f) << endl;
   cout << " The Size of wchar_t   : " << sizeof(g) << endl;
   return 0;
}

Output of the Program

Data Types with sizes

Share:

0 comments:

GNIITSOLUTION GNIIT SOLUTION. Powered by Blogger.

Translate

Blog Archive

Unordered List