On 8/1/07, Thomas Hruska <[EMAIL PROTECTED]> wrote: > saravanan kumar wrote: > > hi friends, > > > > hw assignment operator is executing? > > > > for example, > > > > int i=1,j,k; > > > > i++ + (j=i);
It doesn't look like UB Thomas - it /is/ UB :) To the OP, this code above is the bit invoking undefined behaviour - you're both modifying i (on the left) and reading i (on the right) in between the same sequence points (in the same statement effectively). > > nw the j value is 2; // i is incremented and assgined., eventhough it is > > post incr > > > > k = i++ + (j=i); > > > > nw the j value is 1. // wht happned here?? > > > > please explain the sequence point for assignment operator., like where it > > can be change the memory value., > > Don't do that. Looks like undefined behavior to me. Separate the above > into multiple statements to declare your intentions. -- PJH "I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." -- Stephen Roberts
