C++26th Code ( print the size of various data types in C++)
Mohammed Salah

Mohammed Salah @md-salah

About: Civil Engineer Like programming

Location:
saudi arabia
Joined:
Jan 15, 2025

C++26th Code ( print the size of various data types in C++)

Publish Date: Jan 30
0 0
#include<iostream>
#include<cstdint>
using namespace std;
int main()
{
cout<<"\n\tint          -->  "<<sizeof(int)<<endl;
cout<<"\n\tuint8        -->  "<<sizeof(uint8_t)<<endl;
cout<<"\n\tuint16       -->  "<<sizeof(uint16_t)<<endl;
cout<<"\n\tuint32       -->  "<<sizeof(uint32_t)<<endl;
cout<<"\n\tuint64       -->  "<<sizeof(uint64_t)<<endl;
cout<<"\n\tint8_        -->  "<<sizeof(int8_t)<<endl;
cout<<"\n\tint16        -->  "<<sizeof(int16_t)<<endl;
cout<<"\n\tint32        -->  "<<sizeof(int32_t)<<endl;
cout<<"\n\tint64        -->  "<<sizeof(int64_t)<<endl;
cout<<"\n\tsigned       -->  "<<sizeof(signed)<<endl;
cout<<"\n\tunsigned     -->  "<<sizeof(unsigned)<<endl;
cout<<"\n\tshort        -->  "<<sizeof(short)<<endl;
cout<<"\n\tlong         -->  "<<sizeof(long)<<endl;
cout<<"\n\tlong long    -->  "<<sizeof(long long)<<endl;
cout<<"\n\tfloat        -->  "<<sizeof(float)<<endl;
cout<<"\n\tdouble       -->  "<<sizeof(double)<<endl;
cout<<"\n\tLong double  -->  "<<sizeof(long double )<<endl;
cout<<"\n\tChar         -->  "<<sizeof(char)<<endl;
cout<<"\n\tString       -->  "<<sizeof(string)<<endl;
cout<<"\n\tbool         -->  "<<sizeof(bool)<<endl;
cout<<"\n\twchar        -->  "<<sizeof(wchar_t)<<endl;
cin.get();
return 0 ;
}
Enter fullscreen mode Exit fullscreen mode

Comments 0 total

    Add comment