#include<iostream>
#include<iomanip>usingnamespacestd;intmain(){cout<<"———————————————————————————————————————————";cout<<"\nProgram to print the size of data types\n";cout<<"———————————————————————————————————————————";cout<<"\nThe size of int "<<setw(11)<<"| "<<sizeof(int)<<"\n";cout<<"The size of float "<<setw(9)<<"| "<<sizeof(float)<<"\n";cout<<"The size of short "<<setw(9)<<"| "<<sizeof(short)<<"\n";cout<<"The size of double "<<setw(8)<<"| "<<sizeof(double)<<"\n";cout<<"The size of long "<<setw(10)<<"| "<<sizeof(long)<<"\n";cout<<"The size of char "<<setw(10)<<"| "<<sizeof(char)<<"\n";cout<<"The size of bool "<<setw(10)<<"| "<<sizeof(bool)<<"\n";cout<<"The size of NULL "<<setw(10)<<"| "<<sizeof(NULL)<<"\n";cout<<"The size of wchar_t "<<setw(7)<<"| "<<sizeof(wchar_t)<<"\n";cout<<"Size of long int "<<setw(10)<<"| "<<sizeof(longint)<<"\n";cout<<"Size of short int "<<setw(9)<<"| "<<sizeof(shortint)<<"\n";cout<<"Size of long double "<<setw(7)<<"| "<<sizeof(longdouble)<<"\n";cout<<"Size of signed int "<<setw(8)<<"| "<<sizeof(signedint)<<"\n";cout<<"Size of unsigned int "<<setw(6)<<"| "<<sizeof(unsignedint)<<"\n";cout<<"Size of signed char "<<setw(7)<<"| "<<sizeof(signedchar)<<"\n";cout<<"Size of unsigned char "<<setw(5)<<"| "<<sizeof(unsignedchar)<<"\n";cout<<"Size of long signed int "<<setw(3)<<"| "<<sizeof(longsignedint)<<"\n";cout<<"Size of long unsigned int"<<setw(0)<<"| "<<sizeof(longunsignedint)<<"\n";cout<<"———————————————————————————————————————————\n";return0;}
Output
kodingwindow@kw:~$ g++ kw.cpp kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program to print the size of data types
———————————————————————————————————————————
The size of int | 4
The size of float | 4
The size of short | 2
The size of double | 8
The size of long | 8
The size of char | 1
The size of bool | 1
The size of NULL | 8
The size of wchar_t | 4
Size of long int | 8
Size of short int | 2
Size of long double | 16
Size of signed int | 4
Size of unsigned int | 4
Size of signed char | 1
Size of unsigned char | 1
Size of long signed int | 8
Size of long unsigned int| 8
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.
Dear User, We are grateful for your interest in the KodingWindow Android app. We intend to soon make it available on the Google Play Store. Currently, you need to install apk manually. Would you like to get the app? Minimum Requirement(s): Android 10