• 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
OperatorNameMeaningExample
&&Logical ANDReturns true if both statements are truex < 5 &&  x < 10
||Logical ORReturns true if one of the statements is truex < 5 || x < 4
!Logical NOTReverse the result, returns false if the result is true!(x < 5 && x < 10)
    int a = 5, b = 5, c = 10, result;
 
 
    result = (a == b) && (c > b); // Output: 1
 
    result = (a == b) && (c < b); // Output: 0
 
    result = (a == b) || (c < b); // Output: 1
 
    result = (a != b) || (c < b); // Output: 0
 
    result = !(a != b); // Output: 1
 
    result = !(a == b); // Output: 0