考虑一下:
int i[50];
void *a = i; //i.e. = &i[0]
void *b = &i;
a == b
是否始终为真,或者是否存在平台/编译器可能并不总是如此?
最佳答案
是的,标准的第 6.5.9 段(相等运算符)说:
Two pointers compare equal if ... both are pointers to the same object (including a pointer to an object and a subobject at its beginning)
关于c - C语言中数组首元素的地址和数组的地址一样吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6289169/