Programming Basic--what is the output of the following code?

#include "iostream"
#include"string.h"
#include "stdio.h"

class A{
};

class A2{
char d,e;
};

struct B{
};

struct C{
char b,c;
};

struct D{
int x,y;
};

int main()
{
count<<sizeof(A)<<endl;
cout<<sizeof(A2)<<endl;
A *p1=new A();
A *p2;
A *p3;
cout<<sizeof(p1<<endl;
cout<<sizeof(p2)<<endl;
cout<<sizeof(p3)<<endl;
cout<<sizeof(B)<<endl;
cout<<sizeof(C)<<endl;
cout<<sizeof(D)<<endl;

return 0;
}

Answer:
1,2,4,1,4,1,2,8

posted on 2008-02-26 09:05  飞天舞者  阅读(378)  评论(0编辑  收藏  举报

导航

For more information about me, feel free email to me winston.he@hotmail.com