
win32位 x86
cout << sizeof(short) << endl;
cout << sizeof(int) << endl;
cout << sizeof(long) << endl;
cout << sizeof(long long) << endl;
cout << sizeof(float) << endl;
cout << sizeof(double) << endl;
cout << sizeof(long double) << endl;
cout << sizeof(char) << endl;
cout << sizeof(int *) << endl;
cout << sizeof(float *) << endl;
cout << sizeof(int[1]) << endl;
cout << sizeof(int[2]) << endl;
cout << sizeof(float[2]) << endl;
结果:
2
4
4
8
4
8
8
1
4
4
4
8
8
win64位 x64
cout << sizeof(short) << endl;
cout << sizeof(int) << endl;
cout << sizeof(long) << endl;
cout << sizeof(long long) << endl;
cout << sizeof(float) << endl;
cout << sizeof(double) << endl;
cout << sizeof(long double) << endl;
cout << sizeof(char) << endl;
cout << sizeof(int *) << endl;
cout << sizeof(float *) << endl;
cout << sizeof(int[1]) << endl;
cout << sizeof(int[2]) << endl;
cout << sizeof(float[2]) << endl;
结果:
2
4
4
8
4
8
8
1
8
8
4
8
8
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)