What are Operators?

An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations. C language supports a rich set of built-in operators. Operators are used in program to manipulate data and variables.

C operators can be classified into following types:

  • Arithmetic operators
  • Relational operators
  • Logical operators
  • Increment and Decrement operators
  • Assignment operators
  • Compound Assignment operators

What are logical operators? Briefly describe with the help of examples.

The logical operators are used to evaluate compound conditions. There are three logical operators in C language:

1. AND operator (&&)
It is used to evaluate two conditions. It gives true result if both conditions are true. It gives false result if any one condition is false.

2. OR operator (||)
It is used to evaluate two conditions. It gives true result if either condition is true. It gives false result if both conditions are false.

3. NOT operator (!)
It is used to reverse the result of condition. It gives true result if the condition is false. It gives false result if the condition is true.