Find the value of x after execution:-
int x=0, y=0, z=0;
x=(++x+y--)*z++;
please tell me the answer fast plzzzz
Answers
Answered by
2
Answer:
x=(1+0)*0
x=1*0="0".
++x is pre increment so its value become 1.but y-- and z++ are post dcrement and post increment respectively,so their value remains same in that line(statement).
hope it helps you
have a great day
Answered by
0
Answer:
The final value of x after execution is 0.
Explanation:
Given that: int x=0, y=0, z=0;
x = (++x + y--) * z++;
x = (++0 + 0--) * 0++;
x=(1 + 0) * 0;
x = 0;
This is because in prefix operator, the increment/decrement takes places before the execution but in postfix operator, the increment/decrement takes place after the execution.
Thus, the final value of x after the execution is 0.
Similar questions
Chemistry,
2 months ago
English,
2 months ago
Political Science,
5 months ago
Hindi,
5 months ago
Social Sciences,
10 months ago