Explain Decrement operator

Decrement operator: It is an operator (--) which adds one to its operand. This has two forms: pre-decrement (--x) and post-decrement (x--). In its pre-decrement form, the outcome of the expression is the value of its argument subsequent to the decrement. In its post-decrement form, the outcome is the value of its argument previous to the decrement is executed. Subsequent to the following,

   int a = 5, b = 5;
    int y,z;
    y = --a;
    z = b--

y has the value of 4 and z has the value of 5. Both a and b encompass the value 4.

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.