so it means after sequence point the post increment is done...after && ht
epost increment is incremented and value is reflected...m i ryt?

On Fri, Oct 26, 2012 at 8:43 PM, Saurabh Kumar <[email protected]> wrote:

> You're right , && || all introduce a sequence point. In first case
> evaluation proceeds like this:
> j = (i++, i++);
> >>  *i++* Post increment the i (i is now 11)
> >>  *j = i++* Post increment the i (j is assigned 11 and i is now 12)
>
> In second case, the whole of rvalue for = operator will be evaluated
> first...
> j = a++ && 1;
> >> *a++ *a is Post incremented (a is now 1 but return value is 0)
> >> *0 && 1* = 0 (which gets assigned to j)
> Hence, j = 0, a = 1
>
> On 26 October 2012 18:54, rahul sharma <[email protected]> wrote:
>
>> Guys plz tell that postincremented variable is  incremented after
>> sequence or after ;
>>
>> as we have && || comma and ; as sequence point
>>
>> so say we have
>> int i=10;
>> int j=(i++,i++);
>> firstly i++ goes and as comma comes so ++ post inc. takes place and take
>> to 11 ..now when next time the postincremented is done later after ;  and
>> firstly the value 11 is assigned to j
>>
>> so after this statement we have j=11,i=12
>>
>> but if i write
>> int a=0;
>> int j=a++&&1;
>> so when && comes so postincrement takes place and assign this to j...so
>> at the point we reach && acc. to me a=1..But a remains 0 as this expression
>> goes to false...can anybody tell me y so happens..when does the value in
>> postincremented is incremented...i am sure about comm and ;...but what in
>> case of && and  ||....these are also sequence point...y post increment
>> doesnt take place when we reach &&...please explain..
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to