Logical AND Operator ("&&") is a binary operator which yields 1 if both of its operands compare unequal to 0; otherwise, it yields 0.
Logical AND Operator (&&
) is a binary operator for which each of the operands shall have scalar type. The &&
operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
yields 0. The result has type int
.
The &&
operator guarantees left-to-right evaluation;
if the second operand is evaluated, there is a sequence point between the evaluations of
the first and second operands. If the first operand compares equal to 0, the second
operand is not evaluated.
Reference: Chapter 6.5.13, C11
Use it if the question is related to the use of &&
operator, in C
, C++
or similar languages.