linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ankit Jain <ankitjain1580@yahoo.com>
To: linux prg <linux-c-programming@vger.kernel.org>
Subject: parse error
Date: Sun, 26 Sep 2004 15:32:52 +0100 (BST)	[thread overview]
Message-ID: <20040926143252.39003.qmail@web52902.mail.yahoo.com> (raw)

hi

i could not understand why compiler has put semi colon
before else due t owhich this parse error comes....

thanks

  
#define exch(x,y) { int tmp; tmp=x; x=y; y=tmp; }

However that wouldn't work in some cases. The
following code is meant to be an if-statement with two
branches:

  if(x>y)
    exch(x,y);          // Branch 1
  else  
    do_something();     // Branch 2

But it would be interpreted as an if-statement with
only one branch:

  if(x>y) {                     // Single-branch
if-statement!!!
    int tmp;            // The one and only branch
consists
    tmp = x;            // of the block.
    x = y;
    y = tmp;
  }
  ;                             // empty statement
  else                  // ERROR!!! "parse error
before else"
    do_something();


________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

             reply	other threads:[~2004-09-26 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-26 14:32 Ankit Jain [this message]
2004-09-25  6:29 ` parse error Elias Athanasopoulos
2004-09-28  6:14   ` Jan-Benedict Glaw
2004-09-26 22:51     ` Elias Athanasopoulos
  -- strict thread matches above, loose matches on Subject: below --
2004-09-27 15:58 Huber, George K RDECOM CERDEC STCD SRI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040926143252.39003.qmail@web52902.mail.yahoo.com \
    --to=ankitjain1580@yahoo.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).