Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question 34 1 pts what will be the value of x after the following code …

Question

question 34
1 pts
what will be the value of x after the following code is executed?
int x, y = 15;
x = y--;
14
16
0
15

Explanation:

Step1: Understand post - decrement

In the statement x = y--;, the value of y is first assigned to x, and then y is decremented by 1.

Step2: Initial value assignment

The initial value of y is 15. So, the value of y (which is 15) is assigned to x first. Then y becomes 14.

Answer:

15