Table of Contents

## Introduction

We are familiar with basic mathematical operations like addition, subtraction, etc. These operations are also valid in programming languages. In this article we will explore Operators in C.

Some symbols tell the compiler about the operation the user wants to perform on the variables. These symbols are called **operators**.

For example, ‘x*y’ is a valid expression in C having operator ‘*’.

The variables used in such expressions or the variables on which operations are performed called operands. In the above example, ‘x’ and ‘y’ are the **operands**.

## Classification of Operators in C

Operators in C are classified into five main categories:

Arithmetic Operators**
**Arithmetic operators take numerical values (literals or variables) as their operands and give a single numeric value as a result.

### Relational Operators

Relational operators are used to check the relation between two operands. **0** and **1** are the results given by relational operators.

### Logical Operators

Logical operators can be made clear by the two connectors used in the English language, i.e. **and** and **or.**

### Assignment Operators

The assignment operator assigns values of the operand on the right side to the operand on the left side (but this is never done vice versa).

### Increment and Decrement Operators

**Increment operator**is represented by ‘++’. This operator adds 1 to the value with which it is written. For example, y++ and ++y will add 1 to the ‘y’.**Decrement operator**is represented by ‘–’.This operator subtracts 1 from the value with which it is written. For example, y–, and –y will subtract 1 from the ‘y’.

## Leave a Reply