0
About how the increment works
I cant understand ho x = 3, y = ++x .. outputs as x=4 and y=4
3 ответов
+ 1
well x is incremented by one (x =4) then is assigned to y ( then y = 4)... note that if used post-increment happen opposite: first x is assigned to y (then y=3) next x is incremented (then x=4)
0
Because it's a prefix increment, so the value of x gets incremented to 4 and then y gets assigned to that value. Alternatively, x++ will assign 3 to y and then increment x to 4 after.
0
thank you for the fast response. really helpful