Decrement operators are used to decrease the value of variable.
Types of Decrement Operators:
1. Pre decrement operator: In pre decrement operator, value of variable is first decreased and then it is assigned to other variable.
Eg: int a=5, b;
b=–a;
Output:
a=5 b=4
2. Post decrement operator: In post decrement operator, value of variable is first assigned and then it is decreased.
Eg: int a=5, b;
b=a–;
Output:
a=5 b=5