Short Circuit Feature For Logical Operators

code:

Expected Output:

Coming Output:

Why this happen?
It happens because left to right associativity of this and when left operand is o it means false so in and it does not go to the right.

Let’s see another example:

Output:

a=6, b=11, c=1

This is happening because left to right associativity and left one is true so it is also iterating to the right one.

For OR operation:

Output:
a=1, b=10, c=1
because in OR if left value is true then another in right will not be increment
Another example:

Output:
a=0 b=11 c=1

here left value a is 0 that means it is false so another right value is incrementing and so b=11. and c is 1 as in or if one value is ture it is true.