error: ‘for’ loop initial declarations are only allowed in C99 mode

来源:互联网 发布:天思是什么软件 编辑:程序博客网 时间:2024/05/16 09:00

用Dev-C++出现error:

error: ‘forloop initial declarations are only allowed in C99 mode

因为我的代码中出现

for(int times  = 1; times <= lineNum; times++)

按照提示,改成如下即可:

int times = 1;```````````for(; times<= lineNum; times++)

即是:

将times定义在for外面

0 0
原创粉丝点击