DEV Community

Mohammed Salah
Mohammed Salah

Posted on

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

#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

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →