0
why in the postfix increment , x increases and y equals " old x" , even if the equals x after increment?
2 Answers
+ 2
int x = 3;
int y = x++;
// result x= 4, y= 3
Because when we have a postfix, the c# first assign the value of x to y, and after this increments the x. x it's incremented after the assignment.
0
Because of assignment to the y of value x (i. e. Y=x) is first, then x will be incremented by one