# C Operators

In computer programming an Operator is something which performs an operation on variable or values. The operators in C can be mainly classified into:

- Assignment Operator
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operator
- Special Operators

## 1. Assignment Operator

The assignment Operator = assigns the value of the expression on its right hand side to the variable on the left hand side.

### Example

n = 1; /* Assign value 1 to variable n */
p = n; /* Assign value of variable n to variable p */

## 2. Arithmetic Operators

Arithmetic Operators are used to perform arithmetic operations. Arithmetic operators in C are

Operator | Meaning |
---|

+ | Addition |

- | Subtraction |

* | Multiplication |

/ | Division |

% | Modulus |

++ | Increment |

-- | Decrement |

### Examples

/* Sum of variables b and c, and subtract by 1;assign result
to variable a */
a = b + c - 1;
/* Multiply variable m by 2 and divide by k, assign result to
variable n */
n = 2 * m / k;
/* Modulus of d by 10 - Divide variable d by 10, assign the
remainder value to variable c */
c = d % 10;
/* Increment the value of variable i by 1 ( i = i + 1 )*/
i++;
/* decrement the value of variable i by 1 (i = i - 1) */
i--;

← Variables in CRelational Operators →