Behaviour

Discussion in 'C Programming' started by prasoonthegreat@gmail.com, Mar 29, 2009.

  1. Guest

    int i=3;
    printf("%d %d %d",++i,i,i++);

    I want to know whether the above shows Undefined Behaviour or
    Unspecified Behaviour ????
     
    , Mar 29, 2009
    #1
    1. Advertising

  2. writes:
    > int i=3;
    > printf("%d %d %d",++i,i,i++);
    >
    > I want to know whether the above shows Undefined Behaviour or
    > Unspecified Behaviour ????


    It's undefined behavior. See C99 6.5p2.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Mar 29, 2009
    #2
    1. Advertising

  3. On Sun, 29 Mar 2009 00:20:49 -0700 (PDT),
    wrote:

    >int i=3;
    >printf("%d %d %d",++i,i,i++);
    >
    >I want to know whether the above shows Undefined Behaviour or
    >Unspecified Behaviour ????


    Read the faq at www.c-faq.com. Your question is 3.2 but you should
    read the whole thing.

    --
    Remove del for email
     
    Barry Schwarz, Mar 29, 2009
    #3
  4. Guest

    here ',' in the printf statement is not a sequence point .....
    am I correct???
     
    , Mar 29, 2009
    #4
  5. writes:
    > here ',' in the printf statement is not a sequence point .....
    > am I correct???


    Correct -- "here" being in the code in the previous article, which we
    can't see in your followup. When you post a followup, please keep
    enough quoted context from the previous article so your followup makes
    some sense to a reader who didn't see (or has forgotten) the previous
    article.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Mar 29, 2009
    #5
  6. CBFalconer Guest

    wrote:
    >
    > int i=3;
    > printf("%d %d %d",++i,i,i++);
    >
    > I want to know whether the above shows Undefined Behaviour or
    > Unspecified Behaviour ????


    Undefined.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.
     
    CBFalconer, Mar 30, 2009
    #6
    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. Antonio

    Strange encoding behaviour

    Antonio, Dec 29, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    433
    Antonio
    Dec 29, 2004
  2. Ingmar Seifert

    Modelsim 5.7c behaviour

    Ingmar Seifert, Oct 8, 2003, in forum: VHDL
    Replies:
    2
    Views:
    616
    Allan Herriman
    Oct 8, 2003
  3. adarsh arora
    Replies:
    0
    Views:
    464
    adarsh arora
    Oct 19, 2003
  4. Jan
    Replies:
    2
    Views:
    1,454
    Mike Treseler
    Dec 16, 2004
  5. Andy Chambers
    Replies:
    1
    Views:
    395
    Daniel Dyer
    May 14, 2007
Loading...

Share This Page