Friday 6 February 2015

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 it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment