누군가 다음 gcc 오류에 대해 자세히 설명해 줄 수 있습니까?C : for 루프 int 초기 선언
$ gcc -o Ctutorial/temptable.out temptable.c
temptable.c: In function ‘main’:
temptable.c:5: error: ‘for’ loop initial declaration used outside C99 mode
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);
}
}
P.S : 나는 막연하게 int i
이 for
루프 전에 선언해야 함을 기억합니다. 나는 C 표준에 대한 역사적인 맥락을 제시하는 대답을 찾고 있다고 언급해야한다.
자세한 내용은 C 변수 선언과 관련된 이전 질문을 확인하십시오. http://stackoverflow.com/questions/288441/variable-declaration-placement-in-c –