NO

Author Topic: Illegal Statemetn Termination  (Read 2607 times)

Vegebond

  • Guest
Illegal Statemetn Termination
« on: August 11, 2010, 02:53:39 PM »
I've been going round and round with this thing for a few hours. Maybe it's time for me to just pull over and ask for directions. What am I doing wrong here? I keep getting "Illegal Statement Termination".

While you're at it, show me how to count to ten and print the alphabet.

Code: [Select]
int main(int argc, char *argv[])
{
int x
for (x=0;x<5;x++) printf("Hello, world!\n") ;
return 0;
}

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Illegal Statemetn Termination
« Reply #1 on: August 11, 2010, 05:04:11 PM »
Code: [Select]
int main(int argc, char *argv[])
{
int x;    //<=== missing semicolon
for (x=0;x<5;x++) printf("Hello, world!\n") ;
for (x=1;x<=10;x++) printf("Counting: %d\n", x) ;
for (x='a';x<='z';x++) printf("alphabet: %c\n", x) ;
for (x='A';x<='Z';x++) printf("ALPHABET: %c\n", x) ;
return 0;
}

Maybe you want to google around for a C programming tutorial.
« Last Edit: August 11, 2010, 05:08:01 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide