The logical and operator &&
first evaluates its left operand. If the result is zero, then the value of the whole expression is the int
value 0. Otherwise the right operand is evaluated; if the result is zero, the value of the whole expression is again 0; otherwise it is 1. The operands must be of type int
.
The logical or operator ||
first evaluates its left operand. If the result is non-zero, then the value of the whole expression is the int
value 1. Otherwise the right operand is evaluated; if the result is non-zero, the value of the whole expression is again 1; otherwise it is 0. The operands must be of type int
.