I'm trying to run simple looping code on new Appliance 2014 based on Ubuntu. However, I receive error. When I run the same piece of code, I have no problem on old appliance.
#include <stdio.h>
#include <cs50.h>
int main (int argc, string argv[])
{
for (int i = 5; i > 0; i--)
{
printf ("%d\n", i);
}
printf ("BLAST OFF]\n");
}
Error message is following:
jharvard@ubuntu:~/pset2$ make caesar
cc caesar.c -o caesar
caesar.c: In function 'main':
caesar.c:6:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i = 5; i > 0; i--)
^
caesar.c:6:5: note: use option -std=c99 or -std=gnu99 to compile your code
make: *** [caesar] Error 1
How can I fix it?
use option -std=c99 or -std=gnu99 to compile your code
?