void main()
{
for(int i=0;i<2;i++)
{
//code
}
}
VC++编译器给出以下的信息:
--------------------Configuration: X - Win32 Debug--------------------
Compiling...
X.C
E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
E:\Project\X.C(15) : error C2143: syntax error : missing ')' before 'type'
E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
E:\Project\X.C(15) : error C2065: 'i' : undeclared identifier
E:\Project\X.C(15) : warning C4552: '<=' : operator has no effect; expected operator with side-effect
E:\Project\X.C(15) : error C2059: syntax error : ')'
E:\Project\X.C(16) : error C2143: syntax error : missing ';' before '{'
执行 cl.exe 时出错.
X.exe - 1 error(s), 0 warning(s)
------------------------------------------------------------------------------------
现在把程序改成这样:
void main()
{
int i;
for(i=0;i<2;i++)
{
//code
}
}
编译通过.
很郁闷,为什么啊?
高手请指教!