Solution-1
In case of nested loops i.e. loops within loops having many conditions to be tested in each loopings, in that case, while evaluating two decisions, a decision must me choosen which of the decisions to make first. In fact, logically, in order of first, second and so on. AND expression must be evaluated first as it has higher precedence than OR condition.
Solution-2
Order of precedence in C/C++
Logical AND && Left to right
Logical OR || Left to right
This means that if logical AND and OR operators are in the same statement, then logical AND has more precedence than logical OR operator.
Comments
Leave a comment