Multiple choice

What is the output of the following program?#include void main() { int x=7,y=6,z; z=x-- -y; cout< }

  1. 1

  2. 0

  3. -1

  4. None of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The expression x-- uses the postfix decrement operator, which returns the current value (7) before decrementing x to 6. So z = 7 - 6 = 1. If it were --x, the answer would be 0.