Back to Course
Operators

Logical Operators in C Programming

What are Logical Operators?

Logical operators combine multiple conditions and return a boolean-like result.

List of Logical Operators

  • && — logical AND, true only if both conditions are true
  • || — logical OR, true if at least one condition is true
  • ! — logical NOT, reverses the result
int a = 5, b = 10;
if (a > 0 && b > 0) {
    printf("Both positive");
}
if (!(a == b)) {
    printf("a is not equal to b");
}

Short-Circuit Evaluation

C evaluates logical expressions left to right and stops as soon as the result is determined — e.g. in &&, if the first condition is false the second is never evaluated.

Ready to master real-world C Programming development?

Learn C Programming hands-on with mentor-led, live sessions.

Explore Course