#include<iostream>
using namespace std;
class A
{
static int b;
};
int main()
{
int a;
short b;
unsigned c;
static int f;
char d;
cout<<sizeof(a)<<endl;
cout<<sizeof(b)<<endl;
cout<<sizeof(c)<<endl;
cout<<sizeof(d)<<endl;
cout<<sizeof(A)<<endl;
cout<<sizeof(f)<<endl;
}
输出为:4,2,4,1,1,4.
sizeof的相关用法
最新推荐文章于 2021-07-16 16:26:43 发布