Program_Coding-Unit-1-cl-8(3)
Program_Coding-Unit-1-cl-8(3)
operators
When An When an
increment or increment or
decrement decrement
operator is used operator is used
before the after the
operand, it is operand, it is
known as a known as the
prefix operator. postfix operator.
It works on the It works on the
principle of: principle of: use
change and use. and then
change.
E.g. p=5, q=5; E.g. p=5, q=5;
p = ++p * 4; p = p++ * 4;
p=6*4 p=5*4
p = 24 p = 20
q= --q * 4; q= q-- * 4;
q= 4 * 4 q= 5 * 4
q= 16 q= 20