19,613
社区成员
发帖
与我相关
我的任务
分享
[root@ns ~]# vi test.c
#include <stdio.h>
int main()
{
int i=0;
for(i=0;i<3;i++){
printf("%d\n",i);
}
return 0;
}
[root@ns ~]# gcc -o test test.c
[root@ns ~]# ./test
0
1
2
[root@ns ~]# vi test.c
#include <stdio.h>
int main()
{
for(int i=0;i<3;i++){
printf("%d\n",i);
}
return 0;
}
[root@ns ~]#gcc -o test test.c
test.c: In function ‘main’:
test.c:4: error: ‘for’ loop initial declaration used outside C99 mode
[root@ns ~]# gcc -o test test.c -std=c99
[root@ns ~]# ./test
0
1
2