问题描述
#include< stdio.h>
int i;
int i;
int main(){
printf(" i =%d \ n",i);
返回0;
}
注意:我在i386上使用gcc-3.4.3-redhat-linux
#include<stdio.h>
int i;
int i;
int main(){
printf("i=%d\n",i);
return 0;
}
Note : I am using gcc-3.4.3 on i386-redhat-linux
推荐答案
为什么不能呢?
-
克里斯Perikles凯旋 Dollin
- 在严格监督下在实验室出生 - , - Magenta,/ Genetesis /
Why shouldn''t it?
--
Chris "Perikles triumphant" Dollin
"- born in the lab under strict supervision -", - Magenta, /Genetesis/
由于两个变量都未初始化,这就是为什么代码是正确编译的原因。
如果你尝试同样的东西,至少其中一个被初始化
有一些价值,那么肯定你的代码不会编译。
干杯,
SandeepKsinha。
As both the variables are uninitialized, thats why the code is
compiling properly.
If you try the same thing with atleast one of them being initialised
with some value, then surely your code will not compile.
Cheers,
SandeepKsinha.
由于两个变量都未初始化,这就是代码正确编译的原因。
如果你尝试同样的东西,至少其中一个被初始化
有一些价值,那么肯定你的代码不会编译。
干杯,
SandeepKsinha。
As both the variables are uninitialized, thats why the code is
compiling properly.
If you try the same thing with atleast one of them being initialised
with some value, then surely your code will not compile.
Cheers,
SandeepKsinha.
只有一次初始化没有任何错误,两者都必须是
初始化为编译器提供错误。
only one initialize doesn''t give any error, both have to be
initialized for the compiler to give the error.
这篇关于为什么这段代码编译正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!