On 21 Mar 2007 12:22:22 -0700, GLOGIC 20 <[EMAIL PROTECTED]> wrote:

> >can any one reveal the concept of i++.
>
> hey hows it going
> from what i know of i++ i is not actually incremented until the line of code
> has been executed
>         int i = 4;
>         int test = 0;
>
>         test = i++;
>         cout << test << endl;//outputs 4 as i was not incremented until
> previous line was executed
>         test = i;
>         cout << test << endl;//outputs 5
>
> hope this was what u were asking?

The correct answer is that statements like  i =i+ i++ + ++i are
invoking undefined behavior. You are modifying the variable multiple
times between sequence points.

http://c-faq.com/expr/seqpoints.html

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to