**Increment Operator (++): **

Increment Operator increases the value by “1”. There are two types of increment operators: Pre increment operator and Post increment operator.

__Post increment:__

Consider the example

int X=3,Y;

Y=X++;

In the above statement ‘X’ value becomes 4 and ‘Y’ takes 3.

__Pre increment:__

Consider the example

int X=3,Y;

Y=++X;

In the above statement ‘X’ value becomes 4 and ‘Y’ also takes 4.

**Decrement Operator (--):**

Decrement Operator decreases the value by “1”. There are two types of decrement operators: Pre decrement operator and Post decrement operator.

__Post decrement:__

Consider the example

int X=3,Y;

Y=X--;

In the above statement ‘X’ value becomes 2 and ‘Y’ takes 3.

__Pre decrement:__

Consider the example

int X=3,Y;

Y=--X;

In the above statement ‘X’ value becomes 2 and ‘Y’ also takes 2.

## 0 comments:

## Post a Comment