> ## Content Index
> Fetch the complete content index at: https://developerinsider.co/llms.txt
> Use this file to discover other available public pages before exploring further.

# Assignment Operators and Increment Operator of C++
- URL: https://developerinsider.co/assignment-operators-and-increment-operator-of-cpp/
- Published: 2016-06-09T05:43:25.000Z
- Updated: 2018-08-18T05:15:34.000Z
- Author: Anit Kumar
- Tags: Primary, C++

## Assignment Operator:

The simple assignment operator (=) assigns the right side to left side.

C++ provides shorthand operators that have the capability of performing an operation and an assignment at the same time.  
**For example:**

```cpp
int x=5;
x+=3;  //It's mean x=x+3
x-=2;  //It's mean x=x-2
x*=2;  //It's mean x=x*2
x/=3;  //It's mean x=x/3

```

## Increment Operator:

The increment operator is used to increase an integer value by one, and is a commonly used C++ operator.

```cpp
x++;  //It's mean x=x+1

```

**For example:**

```cpp
int x=10;
x++;
cout<<x;

```

**Output:**

```
11

```

The increment operator has two forms, prefix and postfix.

```cpp
++x;  //prefix
x++;  //postfix

```

**Prefix:** Prefix increments the value, and then proceeds with the expression.

**Postfix:** Postfix evaluate the expression and then performs the increment.

**Prefix example:**

```cpp
x=4;
y=++x;  //x is 4, y is 5

```

## Decrement Operator:

The decrement operator (-) works in much the same way as the increment operator, but instead of increasing the value, it decreases it by one.

```cpp
--x;  //prefix
x--;  //postfix

```