int a = 48, b; find b= a++ + ++a
Answers
Answered by
26
int a=48,b;
b=a++ + ++a
=48 + 50
=98
Therefore, b=98.
b=a++ + ++a
=48 + 50
=98
Therefore, b=98.
Answered by
85
We're initializing a as 48.
Then, we set b as (a++) + (++a).
Let's break that down.
a++ will first increment a by 1 and return a-1.
So before the addition operator, we have the number 48,
[But the value of a is 49]
++a will first increment a by one and then return the new value of a.
So after the addition operator, we have the number 50.
Now, we know we have to add 48 and 50.
And 48 + 50 = 98.
I hope that helps...
Let me know in the comments if you still have doubts or a difficulty in understanding...
PS: Please consider marking this answer as the brainliest if you think it deserves that. Thanks!
Then, we set b as (a++) + (++a).
Let's break that down.
a++ will first increment a by 1 and return a-1.
So before the addition operator, we have the number 48,
[But the value of a is 49]
++a will first increment a by one and then return the new value of a.
So after the addition operator, we have the number 50.
Now, we know we have to add 48 and 50.
And 48 + 50 = 98.
I hope that helps...
Let me know in the comments if you still have doubts or a difficulty in understanding...
PS: Please consider marking this answer as the brainliest if you think it deserves that. Thanks!
Similar questions