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. Advertising

  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. Advertising

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:
    691
    Riyaz
    May 5, 2004
  2. Geo
    Replies:
    0
    Views:
    467
  3. Geo
    Replies:
    6
    Views:
    518
  4. fadics
    Replies:
    7
    Views:
    460
    Richard Herring
    Feb 1, 2005
  5. Replies:
    4
    Views:
    743
Loading...

Share This Page