The logical operators are also called Boolean operators. The name Boolean comes from George Boole, who first described the branch of mathematics that works with truth values, instead of numbers.
Do you learn better from video?
Learn faster with deeper understanding! 
C has three logical operators:
They all work with truth values and return as result truth value.
Note:If you are comming from another language like Java or C#:
Do not confuse the boolean operators && and  with the operators & and . In C, the & and  operators are only bitwise.
The boolean operator && returns true only when all its operands are true. let's visualize this:

which is the same as 

The logical operator  returns true, if at least one of the operands is true. If they are all false, it returns false. Here's its truth table:

which is equivallent to 

Do you learn better from video?
Learn faster with deeper understanding! 
The negation always returns the opposite of its operand. NOT true is false. NOT false is true. Simple logic ;)
Previous: switch 
Next: Loops in C 
Did this help? Support me with your vote ;) 


Did this help? 

