+ 2

Help?? C#

Can anyone explain what x++ and ++x means?

21st Jan 2018, 7:40 PM
GeordieGaming
GeordieGaming - avatar
4 Respuestas
+ 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);
21st Jan 2018, 8:09 PM
Vincent
Vincent - avatar
+ 2
Also to add onto Vincent's answer: x++ is called post increment ++x is called pre increment
21st Jan 2018, 8:28 PM
Tarantino
Tarantino - avatar
+ 2
Thank you guys Perfect!
21st Jan 2018, 8:42 PM
GeordieGaming
GeordieGaming - avatar
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
22nd Jan 2018, 2:11 AM
Sujith k sukumar
Sujith k sukumar - avatar