An operator is a symbol that tells the compiler to perform specific mathematical or logical functions.

##### Arithmetic Operators

An arithmetic operator performs mathematical operations such as addition, subtraction and multiplication on numerical values (constants and variables).

Operator |
Meaning of Operator |

+ | addition or unary plus |

– | subtraction or unary minus |

* | multiplication |

/ | division |

% | remainder after division( modulo division) |

###### Comparison Operators

A Comparison/relational operator checks the relationship between two operands. If the relation is true, it returns 1; if the relation is false, it returns value 0.

Comparison/Relational operators are used in decision making and loops.

Operator |
Meaning of Operator |
Example |

== | Equal to | 5 == 3 returns 0 |

> | Greater than | 5 > 3 returns 1 |

< | Less than | 5 < 3 returns 0 |

!= | Not equal to | 5 != 3 returns 1 |

>= | Greater than or equal to | 5 >= 3 returns 1 |

<= | Less than or equal to | 5 <= 3 return 0 |

###### Boolean Operators

Boolean operators are also called Logical Operators and are used in decision making. Depending on an expression having logical operator, an answer returns either 0 or 1 depending upon whether expression results true or false.

Operator |
Meaning of Operator |
Example |

&& | Logial AND. True only if all operands are true | If c = 5 and d = 2 then, expression ((c == 5) && (d > 5)) equals to 0. |

|| | Logical OR. True only if either one operand is true | If c = 5 and d = 2 then, expression ((c == 5) || (d > 5)) equals to 1. |

! | Logical NOT. True only if the operand is 0 | If c = 5 then, expression ! (c == 5) equals to 0. |

###### Bitwise Operators

Bitwise operators are used to perform bit-level operations.

Operators |
Meaning of operators |

& | Bitwise AND |

| | Bitwise OR |

^ | Bitwise exclusive OR |

~ | Bitwise complement |

<< | Shift left |

>> | Shift right |

###### Assignment Operators

An assignment operator is used for assigning a value to a variable. The most common assignment operators are

Operator |
Example |
Same as |

= | a = b | a = b |

+ = | a += b | a = a + b |

– = | a -= b | a = a – b |

* = | a *= b | a = a * b |

/ = | a /= b | a = a / b |

% = | a %= b | a = a % b |

| = | a | = b | a = a | b |

& = | a & = b | a = a & b |