Sequence points

Discussion in 'C++' started by Sheky, Sep 18, 2011.

  1. Sheky

    Sheky Guest

    Hi,
    consider this program:

    #include<iostream>
    using namespace std;
    int main()
    {
    int i=0;
    i= ++i + 1 + (i++*4);
    cout<< i;
    return 0;
    }
    how value of i will be calculated? what is the relation of
    sequence point with this problem?
    Sheky, Sep 18, 2011
    #1
    1. Advertising

  2. Sheky

    Sheky Guest

    so is it also undefined?
    i=i++ +1;// it gives answer : i+2

    explain more on sequence point. and same rule is with C also?
    Sheky, Sep 18, 2011
    #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. Dave Theese

    Sequence points

    Dave Theese, Sep 3, 2003, in forum: C++
    Replies:
    2
    Views:
    328
    Karl Heinz Buchegger
    Sep 3, 2003
  2. Timothy Madden

    Does C++ have sequence points ?

    Timothy Madden, Sep 20, 2004, in forum: C++
    Replies:
    4
    Views:
    395
    Peter van Merkerk
    Sep 21, 2004
  3. j

    Sequence points

    j, Jul 23, 2003, in forum: C Programming
    Replies:
    4
    Views:
    368
    Tak-Shing Chan
    Jul 24, 2003
  4. akarl

    Knowing your sequence points

    akarl, Aug 11, 2005, in forum: C Programming
    Replies:
    7
    Views:
    379
    Jack Klein
    Aug 12, 2005
  5. Question about sequence points

    , Aug 4, 2006, in forum: C Programming
    Replies:
    3
    Views:
    271
    Clark S. Cox III
    Aug 12, 2006
Loading...

Share This Page