您的位置:首页 > 编程语言 > C语言/C++

一个小问题,c++

2004-10-16 00:24 330 查看
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
  }
}

编译通过.

很郁闷,为什么啊?
高手请指教!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: