因为“unsigned int”的范围等于“int *”的范围或任何指针,因为两者在 64 位平台上都占用 4 个字节。 C中的指针可以用unsigned int代替吗??
最佳答案
unsigned int
没有这样的保证.特殊类型 uintptr_t
是在 C99 中引入的,用于保存指针,与平台无关。您需要包括 <stdint.h>
header 以使用此类型。
关于unsigned int可以替换C中的指针吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19769335/