Berikut ini kode program untuk mengetahui ukuran memori yang diperlukan tipe data.
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- cout<<"Ukuran char = "<<sizeof(char)<<endl;
- cout<<"Ukuran short = "<<sizeof(short)<<endl;
- cout<<"Ukuran int = "<<sizeof(int)<<endl;
- cout<<"Ukuran long = "<<sizeof(long)<<endl;
- cout<<"Ukuran float = "<<sizeof(float)<<endl;
- cout<<"Ukuran double = "<<sizeof(double)<<endl;
- cout<<"Ukuran longdouble = "<<sizeof(long double)<<endl;
- getch();
- }
Output Program:
No comments:
Post a Comment