0
What does x++ mean?
Do I add the initialized x before or after adding itself again?
3 Answers
+ 2
Post-increment operator is used to increment the value of variable as soon as after executing expression completely in which post increment is used. In the Post-Increment value is first used in a expression and then incremented.
b = x++;
In this example suppose the value of variable ‘x’ is 5 then value of variable ‘b’ will be 5 because old value of ‘x’ is used.
+ 2
int x =4;
console.writeline(x++); -> output 4 and x is now 5
console.....(++x); -> output 5 and x is now 5 obvi
+ 1
In an easy word:
x++=x+1