What's the meaning of this sentence, "0;"?

Discussion in 'C++' started by fadics, Jan 30, 2005.

  1. fadics

    fadics Guest

    0;
    The above sentence can be compiled. What does it mean? Why C++ can compile
    such sentence?
     
    fadics, Jan 30, 2005
    #1
    1. Advertisements

  2. fadics wrote:

    > 0;
    >
    > The above sentence can be compiled.
    > What does it mean?


    Nothing.

    > Why C++ can compile such sentence?


    Because 0 is a perfectly valid expression in C.

    > cat f.c

    void f(void) {
    0;
    }

    > gcc -Wall -std=c99 -pedantic -c f.c

    f.c: In function `f':
    f.c:2: warning: statement with no effect
     
    E. Robert Tisdale, Jan 31, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jluis
    Replies:
    3
    Views:
    799
    Riyaz
    May 5, 2004
  2. Geo
    Replies:
    0
    Views:
    557
  3. Geo
    Replies:
    6
    Views:
    682
  4. Matt
    Replies:
    11
    Views:
    52,778
    satyam000
    Aug 16, 2010
  5. Ian Pilcher
    Replies:
    0
    Views:
    3,879
    Ian Pilcher
    Dec 12, 2003
  6. BernieH

    Sentence case

    BernieH, Oct 6, 2004, in forum: HTML
    Replies:
    7
    Views:
    7,418
    Mark Parnell
    Oct 7, 2004
  7. fadics
    Replies:
    7
    Views:
    533
    Richard Herring
    Feb 1, 2005
  8. Replies:
    4
    Views:
    994
Loading...