logical operators
C language logical operators include:
- Logical AND (
&&
): Returns true if both operands are true.
c
int result = (a && b);
- Logical OR (
||
): Returns true if at least one of the operands is true.
c
int result = (a || b);
- Logical NOT (
!
): Returns true if the operand is false and false if the operand is true.
c
int result = !a;
Logical operators are often used to create complex conditions in control statements and loops.