- An expression containing logical operator returns either 0 or 1 depending upon whether expression results true or false.
- Logical operators are commonly used in C If … Else, C For Loops, C While Loops
Operator | Name | Meaning | Example |
---|
&& | Logical AND | Returns true if both statements are true | x < 5 && x < 10 |
|| | Logical OR | Returns true if one of the statements is true | x < 5 || x < 4 |
! | Logical NOT | Reverse the result, returns false if the result is true | !(x < 5 && x < 10) |