How we can use increment and decrement operator in c++ code


Increment mean increase one number and decrement mean decrease one number. ++ sign show the incement operator and -- sign show the decrement operator.

Increment Operator:


There are two types of increment operator.
(i) Pre-increment                           (ii) Post-increment

(i) Pre-increment:


Pre-increment mean first increase and than output.

For example  ++num

(ii) Post-increment:


Post-increment mean first output and than increase a number.

For example  num++

Decrement Operator:

There are also two types of decrement operator.
(i) Pre-decrement                          (ii) Post-decrement

(i) Pre-decrement:

Pre-decrement mean first decrease and than output.

For example  --num

(ii) Post-decrement:

Post-decrement mean first output and than decrease a number.

For example  num--

Click here for watching the video of that code


avatar
AUTHOR: Muhammad Abbas
I am Software Engineer.

0 Comments