adlu 发表于 2016-1-21 09:03:23

受教了,签到:):):)

zhoupxa 发表于 2016-1-21 09:03:28

3个字节:lol

烟花绽放 发表于 2016-1-21 09:05:07

         4个

liu553824989 发表于 2016-1-21 09:06:37

这是个结构体,内存跟union不一样,这个不共用,所以,char字符类型占用一个字节,int一般来说占用4个字节,short int占用两个字节。

alvin_ 发表于 2016-1-21 09:06:43

:loveliness:

zhangdaijin 发表于 2016-1-21 09:08:12

             4:(:(:(

火蒂树 发表于 2016-1-21 09:09:28

8位3个32位4个

斜阳__ 发表于 2016-1-21 09:09:30

大小应该使用sizeof()函数测量,这个结构体长度受到机器字长和对齐方式影响,是不确定的

弋江浪子 发表于 2016-1-21 09:09:42

4个。。。。。。

Mandelbrot_Set 发表于 2016-1-21 09:10:17

取决于上下文!


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

页: 1 2 [3] 4 5 6 7 8 9 10 11 12
查看完整版本: 【1.21签到】每日问答——下列程序占几个字节