作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
char
是 1 字节增量。 int
是 2 字节增量。 float
是 4 字节增量。 double
是8字节增量。为什么int在这里增加4字节?
最佳答案
试试这个:
int i;
...
printf("%d",sizeof(i));
你得到了什么?最有可能 4. 为什么?因为你的CPU很可能是32位的。 2 字节 int 在较旧的 CPU 上是正确的...
永远不要根据“应该”来假设变量的大小,始终使用 sizeof()!
关于c++ - 为什么是 0022FF08 + sizeof(int) = 0022FF0C 而不是 0022FF0A?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12968615/
我是一名优秀的程序员,十分优秀!