they are ++(increment) and - - (decrement) operator. the operator ++ adds 1 to the operand, and - - subtract 1.both are unary operator and takes the following form.
++m and m++
- - m and m--
we use increment and decrement in for and while loops.
Example :
#include<stdio.h>
printf("1) y=%d and m=%d", y, m) ;
y=++m;
printf("2) y=%d and m=%d", y, m) ;
y=m--;
printf("3) y=%d and m=%d", y, m) ;
y=--m;
printf("4) y=%d and m=%d", y, m) ;
}
out put : 1) y=5 and m=6.
2) y=6 and m=6.
3) y=5 and m=4.
4) y=4 and m=4.
So, it is a unary operators.
❮ Previous Next ❯
0 Comments