Effectivement en -std=c99 ça marche, mais par défaut gcc te jette avec l'erreur suivante :
test.c: In function ‘main’:
test.c:6: error: ‘for’ loop initial declaration used outside C99 mode
Le code :
#include <stdio.h>
int main(int argc, char **argv)
{
for(int i = 0; i < 5; i++)
{
printf("i = %d\n", i);
}
return 0;
}
[^] # Re: Euh
Posté par Raphaël G. (site web personnel) . En réponse au message Le break dans le fork(). Évalué à 2.
test.c: In function ‘main’:
test.c:6: error: ‘for’ loop initial declaration used outside C99 mode
Le code :
#include <stdio.h>
int main(int argc, char **argv)
{
for(int i = 0; i < 5; i++)
{
printf("i = %d\n", i);
}
return 0;
}