为什么数组的地址等于它在C中的值?
在下面的代码中,指针值和指针地址按预期不同。
但数组值和地址不行!
怎么会这样?
产量
my_array = 0022FF00&my_array = 0022FF00pointer_to_array = 0022FF00&pointer_to_array = 0022FEFC
#include <stdio.h>int main(){ char my_array[100] = "some cool string"; printf("my_array = %p\n", my_array); printf("&my_array = %p\n", &my_array); char *pointer_to_array = my_array; printf("pointer_to_array = %p\n", pointer_to_array); printf("&pointer_to_array = %p\n", &pointer_to_array); printf("Press ENTER to continue...\n"); getchar(); return 0;}
MMTTMM
茅侃侃
梦里花落0921