+ 2
Help?? C#
Can anyone explain what x++ and ++x means?
4 Answers
+ 3
++ mean you add +1 to your variable.
now, for which do what, a simple example :
//print x THEN add +1
Console.WriteLine(x++);
//add +1 THEN print x
Console.WriteLine(++x);
+ 2
Also to add onto Vincent's answer:
x++ is called post increment
++x is called pre increment
+ 2
Thank you guys Perfect!
0
the x++ will be like your post paid mobile connection, pay after use. whereas the ++x is prepaid connection you need to pay before use. they follows the following order
++x : change then use
x++ : use then change