-1
因为我们知道变量的extern声明可以被初始化。变量的双重定义
#include<stdio.h>
extern int a=5; //will work as both definition and declaration.
int main()
{
}
为什么这个程序是编译和无差错运行。
extern int a=5; //will work as both definition and declaration.
int main()
{
}
int a; // isn't it second definition??
大概有http://stackoverflow.com/questions/3095861/about-tentative-definition做 – Kos 2013-04-29 17:30:05
感谢@Kos,这个线程是非常丰富的,我没有在我的搜索中找到它:( – user2333014 2013-04-29 17:39:36
也相关:http://stackoverflow.com/questions/1490693/tentative-definitions-in-c99-and-linking – 2013-04-29 18:00:44