您的位置:首页 > 编程语言 > PHP开发

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

2008-02-26 09:05 351 查看
#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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: