+ 1
Prefix and Postfix
When looking at Postfix Int x = 3; Int y = x++; Console.WriteLine(x+(â â)+y); // x output is 4, y output is 3 But how come (int y) doesnât also get a +1 since we did y = x++, because if the variable y equals x++ shouldnât it also be 4?
1 Resposta
+ 3
If you assign x++ to y, you are assigning the original value of x rather than x+1.
But if you assign ++x, you are assigning x+1.
Of course eventually the x is increased by 1.