+ 2
Tell me if i'm right, i want to make sure i understand that.
if x=9; y=x++; the answer is: x=10; y= 9; but if x=9; y=++x; the answer is: x=10; y=10; It's ok? anything else about that i should know?
2 Respostas
+ 4
Hi Maor
When is executed y=++x, this is prefix operation. First x is incremented plus one and then x value is assigned to y.
When is executed y=x++, this is posfix operation. First the x value is assigned to y and then x is incrementes plus one.
I hope it helps.
+ 1
Thank you Ricardo!!