0

why in the postfix increment , x increases and y equals " old x" , even if the equals x after increment?

19th Aug 2016, 7:58 PM
Omar Hossam
Omar Hossam - avatar
2 odpowiedzi
+ 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.
20th Aug 2016, 9:24 AM
Gighi
Gighi - avatar
0
Because of assignment to the y of value x (i. e. Y=x) is first, then x will be incremented by one
30th Dec 2016, 4:47 AM
Demo Hi
Demo Hi - avatar