Logic and operators && logic or operators | | The result of the logical non-operator! operation is only 2, "true" is 1, "false" is 0 && logic and operator 1. Use format condition a && conditional b 2. The result of the operation is only when condition A and condition B are true, the result is 1, which is true, and the rest of the case is 0, which is false, so if a condition a or condition B is not true, the result is 0, that is, the combination of false logic is: From left to right If the value of a is 4: First Judge A>3, set up, and then Judge A<5, also established. So the result is 1 if the value of a is 2: First Judge A>3, not set up, stop judging. So the result is 0 therefore, if the value of a is within the range of (3, 5), the result is 1; otherwise, the result is 0 | | Logical OR operator 1. Use format condition A | | Condition b 2. Results When condition A or condition B is set up (also including condition A and condition B), the result is 1, which is "true", and only if condition A and condition B are not set, the result is 0, which is "false". Logic and the combination of the way is: from left to right always first determine whether condition A is set up if condition A is established, it will not be judged whether the condition B is set up, because condition A has been established, regardless of condition B, it is determined to be true, that is, 1. If the condition A is not established, then to determine whether the condition B is set up, if the condition B is set up, the result is also true, that is, 1, if the condition B is not established, that is false, that is 0. example: if a value is 4: First Judge a<3, not set; 5, nor is it tenable. So the result is 0 if the value of a is 2: First Judge A<3, set up, stop judging. So the result is 1 . Therefore, if the value of a is within the range of (-∞, 3) or (5, +∞), the result is 1; otherwise, the result is 0 ! logical non-use format ! Condition a operation result actually is to take the inverse of condition A: If condition A is established, the result is 0, namely "false", if condition A is not established, the result is 1, namely "true". That is to say: true false, False true logical non-union direction is "from right to left". Like an expression! (a>5) If the value of a is 6: First Judge A>5, set up, and then take the result of 0 if the value of a is 2: first Judge a>3, not set, and then take the result of the inverse is 1 therefore, if the value of a is greater than 5, the result is 0; otherwise, the result is 1.
C language: logical operators