有人可以详细说明以下gcc错误吗?
$ gcc -o Ctutorial/temptable.out temptable.c
temptable.c: In function ‘main’:
temptable.c:5: error: ‘for’ loop initial declaration used outside C99 mode
Run Code Online (Sandbox Code Playgroud)
temptable.c:
...
/* print Fahrenheit-Celsius Table */
main()
{
for(int i = 0; i <= 300; i += 20)
{
printf("F=%d C=%d\n",i, (i-32) / 9);
}
}
Run Code Online (Sandbox Code Playgroud)
PS:我含糊地回忆起int i
应该在for
循环之前声明.我应该声明我正在寻找一个给出C标准历史背景的答案.