Pre/Post increment
In pre-increment operand will be altered in value before it is utilized. In post-increment operand will be altered after it is utilized.
In the above snippet
x = ++a is equivalent to
a = a +1 then
x = a
y = b++ is equivalent to
y = b
then b = b + 1
So the value of y = 10 and b = 11
No comments:
Post a Comment