int x= 4
x+ = (x++) + (++x) + x;
Answers
Answered by
1
Output = 17
x+ is equivalent to x = x +
So the given statement will be rewritten as:
x = x + (x++) + (++x) + x;
= 4 + 4 + 5 + 4
= 17
The value of x++ will be 4 because it is a post-increment i.e. its increment will be reflected in the next upcoming statement, after executing the current one.
In contrast, the value of ++x will be 5 because it is a pre-increment i.e. it will increment the given variable before executing the whole statement.
Similar questions
English,
2 months ago
Math,
2 months ago
Hindi,
2 months ago
English,
4 months ago
India Languages,
4 months ago
English,
9 months ago
World Languages,
9 months ago