+ 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 Antwort
+ 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.