受教了,签到:):):)
3个字节:lol
4个
这是个结构体,内存跟union不一样,这个不共用,所以,char字符类型占用一个字节,int一般来说占用4个字节,short int占用两个字节。
:loveliness:
4:(:(:(
8位3个32位4个
大小应该使用sizeof()函数测量,这个结构体长度受到机器字长和对齐方式影响,是不确定的
4个。。。。。。
取决于上下文!
Link: http://codepad.org/AmaQrkQp [ raw code | output | fork ] Save this paste
Delete this paste
C++, pasted just now:
1
2
3
4
5
6
7
8
9
10
11
12
#include "stdio.h"
#define char int
struct _A
{
char a;
short b;
};
int main()
{
printf("%d",sizeof(_A));
}
#undef char
Output:
1
8