【发布时间】:2015-07-06 11:21:17
【问题描述】:
所以,假设我有:
file1.c
int i;
static int j;
int main ()
{
for ( int k = 0; k < 10; k++ )
{
int foo = k;
}
}
file2.c
{
// the following statements are before main.
extern int i; // this is acceptable, I know since i acts as a global variable in the other file
extern int j; // Will this be valid?
extern int foo; // Will this be valid as well?
}
因此,我怀疑标有问号的陈述是否有效?
【问题讨论】:
-
是什么阻止你询问你的编译器?
-
这个问题没有任何意义,extern和static是彼此的对立面。您本质上是在问“红色汽车可以在保持红色的同时变成蓝色吗?”。
-
@molbdnilo 编译器不具有权威性
标签: c