Friday 21 October 2011

How to C++ Data type and size of .

C++ Data type and size of.
After a long time did not post the label C + + programming, this time accomplished as well, although I'm posting this is a simple program. Because I was so busy before the exam rarely tamper with C + +. In the interim, please permaklumannya. Here is a program to see how big the memory size of basic data types in C + +. Data types are char, short, int, long, double, and long double. To be able to know the memory size of basic data types, the syntax used is sizeof.
Here is the syntax of the program:



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

void main()
{
 clrscr();

 cout<<"Ukuran char         : "<<sizeof(char)<<endl;
 cout<<"Ukuran short        : "<<sizeof(short)<<endl;
 cout<<"Ukuran int          : "<<sizeof(int)<<endl;
 cout<<"Ukuran long         : "<<sizeof(float)<<endl;
 cout<<"Ukuran double       : "<<sizeof(double)<<endl;
 cout<<"Ukuran long double  : "<<sizeof(long double)<<endl;

 getch();
}

No comments:

Post a Comment