Prev: Logic
|| and && operators act as logical or and and
operators, respectively. The expression (a || b) has the value
of a if a is true, or the value of b if a is
false. The expression (a && b) has the value of a if
a is false, and the value of b if a is true.
C--'s logical operators are short-circuit operators,
meaning that the right-hand argument is not evaluated if the left-hand
argument is sufficient to determine the value of the expression. This
is important if the right-hand argument has side-effects or could cause
an error.
The ?| operator is a trinary operator, with the following syntax:
condition ? true-expr | false-exprThe result of this expression is the result of true-expr if condition is true, or the result of false-expr if condition is false. See Data Types for the definition of truth for
C-- data.