C: for loop int Erstdeklaration

Kann mal jemand näher auf die folgenden gcc-Fehler?

$ 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: ich vage erinnern, dass int i sollten deklariert werden, bevor eine for Schleife. Sollte ich feststellen, dass ich bin auf der Suche nach einer Antwort, gibt einen historischen Kontext von C-standard.

InformationsquelleAutor der Frage Midnight Blue | 2009-08-17

Schreibe einen Kommentar