以下声明之间有什么区别:
int* arr1[8];
int (*arr2)[8];
int *(arr3[8]);
Run Code Online (Sandbox Code Playgroud)
理解更复杂的声明的一般规则是什么?
我尝试了一些代码来检查数组和指针的行为.其内容如下.
#include <stdio.h>
main(){
int s[]={1,2};
int *b=s;
printf("%d, %d, %d\n", s, &s, *s);
printf("%d, %d, %d\n", b ,&b, *b);
}
Run Code Online (Sandbox Code Playgroud)
最初我认为指针和数组是相同的但是......
令我惊讶的是,'s'和'&s'的值与'b'不同.这是否意味着一个数组变量"指向自己?"
我现在也对变量"名称"实际上是什么感到困惑?如何与内存中的位置进行绑定?我只是无法想象那里发生的事情!内存(RAM)中的所有信息都是在运行时存储的?