Multiple choice technology programming languages

What is the output of the following code: int v() { int m=0; return m++; } int main() { cout<

  1. 1

  2. 0

  3. Code cannot compile

  4. Run time error

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

The post-increment operator m++ evaluates to the current value of m (which is 0) and then increments it. Thus, 0 is returned and printed. The incremented value is discarded after return.