Prem Krishna Chettri +1 * * The precedence of && > || && has higher priority than || . check in this case: int i=0,j=0,k=0; int x =i++ || ++j && k;
the output is : x=0 i=1 j=1 k=0 the control flows from L to R . First 'i' is incremented( but i=0 is checked as it's post increment, but in o/p i=1), since || finds 0 (ie i=0 ) at its left, the control flows further to the right and evaluates ++j. Now ++j&&k is equivalent to 1&&0, which makes it 0, (notice && is evaluated first). now 0 || 0 is evaluated, which comes out to be 0, so x is assigned 0 as the total expression evaluates as false. * * On Sun, Jun 17, 2012 at 11:26 PM, rahul venkat <rahul911...@gmail.com>wrote: > yea it s short circuiting .... > > -- > 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. > -- Firoz Khursheed Computer Science & Engineering -- 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.