In this chapter, we will look into the way that how each Operators in C works.
Operators
A symbol which tells the compiler to perform specific mathematical or logical function is called an Operator. C language has various built-in operators.
Types
C provides the following type of operators.
- Arithmetic operators
- Relational Operators
- Logical operators
- Bitwise operators
- Assignment operators
- Misc operators
Arithmetic Operators
All the arithmetic operators which are supported by the C language are shown in the following table & assume that variable A holds 10 & variable B holds 20, then:

Relational Operators
All the relational operators which are supported by the C language are shown in the following table & assume that variable A holds 10 & variable B holds 20, then:

Logical Operators
All the logical operators are shown in the following table & assume that variable A holds 10 & variable B holds 20, then:

Bitwise Operators
The operator works on bits & perform bit-by-bit operation. The Truth table for &, |, and ^ is as follows:

Assume A = 60 & B = 13 in binary format, then they will be as follows:
A = 0011 1100
B = 0000 1101
………………………..
A&B = 0000 1100
A|B = 0011 1101
A^B = 0011 0001
~A = 1100 0011
All the Bitwise operators which are supported by the C language are shown in the following table & assume that variable A holds 60 & variable B holds 13, then:

Assignment Operators
The assignment operators which are supported by the C language are shown in the following table.

Misc Operators -> Sizeof & ternary
Besides the operators, which are discussed above, there are few other important operators including Sizeof & ?:

Operators Precedence in C
It determines the grouping of terms in an expression & decides how an expression is evaluated. Some operators have higher precedence than others.
For Example: The multiplication operator has higher precedence than Addition operator.
For Example: x = 7 + 3 * 2;
Here, x is assigned 13 not 20 because * operator has a high precedence than +, so first, it get multiplied with 3 * 2 & then adds with 7.
In the below table, operators of high precedence appear at the top of the table & lowest at the bottom.

Subscribe our channels: