adspace
write the value of x and y after execution of the statements:
int x=19,y;
y=x++ + ++x;
x++;
y++;
Answer Posted / Padam Rani
int x=19,y; y=x++ + ++x; x++; y++;nAfter executing these statements, the variable x will have a value of 21, and variable y will have a value of 41. The reason is as follows: first, y is assigned the value of x++ which increments x to 20. Then, ++x is used which also increments x to 21. This new value (21) is added to the initial value of x (19), resulting in 40. y is then incremented again, making its final value 41.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
No New Questions to Answer in this Category !! You can
Post New Questions
Answer Questions in Different Category