标签:sizeof struct写一个类 struct thinkinginc++
/**
* 功能:用sizeof运算符可以确定struct的长度。
* 时间:2014年8月18日08:10:14
* 作者:cutter_point
*/
#include"CLib.h"
#include"CppLib.h"
#include<iostream>
using namespace std;
struct A
{
int i[100];
};
struct B
{
void f();
};
void B::f(){}
int main()
{
cout<<" sizeof struct A= "<<sizeof(A)<<" bytes"<<endl;
cout<<" sizeof struct B= "<<sizeof(B)<<" bytes"<<endl;
cout<<" sizeof CStash in C= "<<sizeof(CStash)<<" bytes"<<endl;
cout<<" sizeof CStash in C++= "<<sizeof(Stash)<<" bytes"<<endl;
return 0;
}
【ThinkingInC++】25、用sizeof运算符可以确定struct的长度。,布布扣,bubuko.com
【ThinkingInC++】25、用sizeof运算符可以确定struct的长度。
标签:sizeof struct写一个类 struct thinkinginc++
原文地址:http://blog.csdn.net/cutter_point/article/details/38655243