计算机组成原理-相关

版权声明:fromZjy QQ1045152332 https://blog.csdn.net/qq_36762677/article/details/82941393

32位机器上

struct A {
	int a;                            //4 bytes
	char b;                        //1 bytes
	char pad[3]               //3 bytes
	int c;                           //4 bytes
	char d;                       //1 bytes
	char pad[3]              //3 bytes
}                            // total = 16 bytes

/* P中有结构体A的成员,但是计算时按照A中数据类型确定的*/

struct P {
	struct A w[2];    // 2 * 16 bytes
	short b;            //2 bytes
	char pad[2]    //2 bytes
	struct A* p;      //4 bytes
}  // total = 40 bytes

猜你喜欢

转载自blog.csdn.net/qq_36762677/article/details/82941393