Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 指针数组外部问题
我们有两个文件:
文件1.c
int myarray[10];
文件2.c
extern int *myarray; void foo() { myarray[0]=10; } void main() { foo(); }
该程序给出了分段错误。但是,如果我们将 更改extern int *myarray为extern int myarray[],则程序可以运行。
extern int *myarray
extern int myarray[]
请解释。谢谢!