大小: 670
备注:
|
← 于2008-02-23 15:37:02修订的的版本3 ⇥
大小: 728
备注: converted to 1.6 markup
|
删除的内容标记成这样。 | 加入的内容标记成这样。 |
行号 1: | 行号 1: |
## page was renamed from TCPL/A.7.15 Logical OR Operator |
A.7.15 Logical OR Operator
- logical-OR-expression:
- logical-AND-expression
logical-OR-expression || logical-AND-expression
- logical-AND-expression
The || operator groups left-to-right. It returns 1 if either of its operands compare unequal to zero, and 0 otherwise. Unlike |, || guarantees left-to-right evaluation: the first operand is evaluated, including all side effects; if it is unequal to 0, the value of the expression is 1. Otherwise, the right operand is evaluated, and if it is unequal to 0, the expression's value is 1, otherwise 0.
The operands need not have the same type, but each must have arithmetic type or be a pointer. The result is int.