值是sizeof(一些指针)总是等于四? [英] Is the sizeof(some pointer) always equal to four?
本文介绍了值是sizeof(一些指针)总是等于四?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:的sizeof(字符*)
返回4一样为int *
,久长*
,我已经竭尽所能。是否有任何例外?
For example:
sizeof(char*)
returns 4. As does int*
, long long*
, everything that I've tried. Are there any exceptions to this?
推荐答案
你得到的保证是,的sizeof(char)的== 1
。有没有其他的担保,包括不保证的sizeof(INT *)==的sizeof(双*)
。
The guarantee you get is that sizeof(char) == 1
. There are no other guarantees, including no guarantee that sizeof(int *) == sizeof(double *)
.
在实践中,三分球的大小为2的16位系统上的64位系统上(如果你能找到一个),4在32位系统上,和8,但没有什么依托中获得在给定的尺寸。
In practice, pointers will be size 2 on a 16-bit system (if you can find one), 4 on a 32-bit system, and 8 on a 64-bit system, but there's nothing to be gained in relying on a given size.
这篇关于值是sizeof(一些指针)总是等于四?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文