These types of operators operate on only one operand, therefore these operators are also called Unary operators.
These two powerful operators in C are + + (Increment), _ _ (Decrement). Operands must be declared as variables not a constant.
These operators may be used either after or before the operand.
When they are used before the operand, it is termed as Prefix while when they are used after the operand they are termed as Postfix.
In prefix operations the value of operator is incremented or decremented first and then the expression is evaluated. Prefix operators has the effect of Change then use.
In postfix operation the expression is evaluated first and then the value of operator is either incremented or decremented. Postfix operators has the effect of Use Then Change.
e.g.: b=a++; this is postfix increment expression. In the expression firstly b=1; then a=a+1; will be executed ,
while in prefix increment expression
firstly a =a-1;then b=a; will be executed.
An example program clarifies the Postfix and Prefix operators:
|Output of the program:|