Consider the following code: int i=0,j=0,k=0; int x = ++i || ++j && ++k;
O/P: x=1,i=1,j=0,k=0 Now, the logic operators are evaluated left to right and if the output is determined by left hand side expression right hand side is not evaluated. But the precedence of && > || hence ++j&&++k should be dealt with first.The output says once ++i evaluates to 1 further expression is not considered. Can anyone explain this anomaly? As of i know associativity is considered when precedence of operators is the same eg: x*y/z will be evaluated left to right. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/rr41g1Q8q38J. 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.
