Logical operators in C
Logical operators are used to operate on Boolean values (true/false) and generate new Boolean values. There are three logical operators in C:
AND operator returns true if and only if its two operands All are true. Otherwise, it returns false. The table is as follows:
Result | ||
---|---|---|
true | true | |
false | #false | |
false | false | |
false |
OR operator returns true if and only if one of its two operands is true. Otherwise, it returns false. The table is as follows:
Operation 1Result | ##true | |
---|---|---|
true | false | |
#false | true | |
false | false | |
NOT (!) |
Operation
true | |
---|---|
false | true |
The above is the detailed content of What are the logical operators in c++. For more information, please follow other related articles on the PHP Chinese website!