## Increment Operator

Increment operator in c language is used to increase variable value. It will increase one value in variable. We use ++ with variable to increase value.

## Types of Increment Operator

There are two types of Increment Operators:-

• Post increment (x++):- in post increment, first task will be performed and then value will be increased.
• Pre Increment (++x):- in pre increment, first value will be increased and then task will be performed.

## Example of Increment Operator

In the following example, we are using both pre and post increment operator. First pre increment will be performed. After pre increment x value would be 11. After that sum will be performed. Sum will be 33 initially. After that two times post increment will be performed then x value would be 13 and y value will be 35.

``````
#include<stdio.h>
void main()
{
int x=10;
int y;

y=++x + x++ + x++;
printf("Y is %d",y);
printf("\nX is %d",x);
}
``````

```		```

Figure 1
```
```

## Decrement Operator

Decrement operator in c language is used to decrease variable value. It will decrease one value in variable. We use -- with variable to increase value.

## Types of Decrement Operator

There are two types of Decrement Operators:-

• Post Decrement (x--):- in post Decrement, first task will be performed and then value will be decreased.
• Pre Decrement (--x):- in pre Decrement, first value will be decreased and then task will be performed.

## Example of Decrement Operator

In the following example, we are using both pre and post Decrement operator. First pre Decrement will be performed. After pre increment x value would be nine. After that sum will be performed. Sum will be 27 initially. After that two times post Decrement will be performed, then x value would be seven and y value will be 25.

```		```
#include<stdio.h>
void main()
{
int x=10;
int y;

y=--x + x-- + x--;
printf("Y is %d",y);
printf("\nX is %d",x);
}

```
```
```		```

Figure 2
```
```
```		```
```
```