#pragma warning(disable:4101)
#include <iostream>
using namespace std;
void main()
{
bool m_bool;
char m_char;
short m_short;
wchar_t m_wchar;
int m_int;
float m_float;
char *m_pchar;
long m_long;
double m_double;
long double m_ld;
cout<<"bool\t\t"<<sizeof(m_bool)<<endl;
cout<<"char\t\t"<<sizeof(m_char)<<endl;
cout<<"short\t\t"<<sizeof(m_short)<<endl;
cout<<"wchar_t\t\t"<<sizeof(m_wchar)<<endl;
cout<<"int\t\t"<<sizeof(m_int)<<endl;
cout<<"float\t\t"<<sizeof(m_float)<<endl;
cout<<"long\t\t"<<sizeof(m_long)<<endl;
cout<<"pointer\t\t"<<sizeof(m_pchar)<<endl;
cout<<"double\t\t"<<sizeof(m_double)<<endl;
cout<<"long double\t"<<sizeof(m_ld)<<endl;
}
结果如下: