The postincrement does take place when you reach the &&, so anything after the && would have a=1, but the value of the expression a++ is still zero. By the definition of postincrement, a++ has the value of a before the increment.
If you wrote int a = 0; int j = a++ || a; You will end up with j=1 because the postincrement will have taken place before the right hand side of the "or" is evaluated. Don On Oct 26, 9:24 am, rahul sharma <rahul23111...@gmail.com> wrote: > > 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.