+ 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?

27th Jul 2016, 3:04 PM
Maor
2 ответов
+ 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.
27th Jul 2016, 3:43 PM
Ricardo Pucca
Ricardo Pucca - avatar
+ 1
Thank you Ricardo!!
27th Jul 2016, 9:28 PM
Maor