Cant see a parse error, but my compiler can

This is a discussion on Cant see a parse error, but my compiler can within the C Programming forums, part of the General Programming Boards category; HI everyone, my compiler says there is a parse error before else, but I dont know what it is? delay ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    8

    Cant see a parse error, but my compiler can

    HI everyone, my compiler says there is a parse error before else, but I dont know what it is? delay is a simple pause function, and the following bit of code is intended to abort a program mid loop by pressing x.

    if ( (ch = getc(stdin)) == 'x')

    break;
    printf("Program aborted. Exiting Program...");
    delay();

    else
    continue;

    Anyone shed some light pls? thanks

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    If you have more than one statement that follows the "if" you need to enclose them in braces { }.

    Like so
    Code:
    if (test)
    {
       Do this;
       And this;
    }
    else
    {
       Do me;
       And me;
    }
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    8
    aha!

    Thanks! It's been a long day.....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 05:42 AM
  2. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 10:28 AM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. Help With finding a compiler
    By macman in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 04-15-2005, 08:15 AM
  5. Compiler questions
    By DvdHeijden in forum C++ Programming
    Replies: 6
    Last Post: 01-17-2005, 02:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21