3. What is the value of y after evaluating the expression given below? x= ++x + x--; when int x=5
Answers
Answered by
0
x=5 5+5+5=15+++++++++++
Answered by
0
The answer is 10.
Explanation:
++x means, x = x+1
x-- means, x=x-1
When x=5
++x is a pre-increment operator and x-- is the post-decrement operator.
In ++x, the value of x will increase firstly, and then it will be used.
So, ++x will be 5
Now, the value of x is 5.
And we will use x=5 for further operations.
x=x-1
x= 6-1
x=5
x-- will be 5.
The expression is x= ++x + x--;
Therefore, the answer is x= 5+5 =10
Similar questions
Math,
3 hours ago
Geography,
3 hours ago
English,
6 hours ago
Political Science,
8 months ago
English,
8 months ago