+ 1

whats the difference x++ and ++x? can anyone ?

6th Jul 2016, 9:54 AM
Janet Contenido
Janet Contenido - avatar
3 Answers
+ 6
x++ is post increment of x and ++x is pre increment of x. x++ use the value of x and then increment it. ++x increment the value of x and then use it.
6th Jul 2016, 11:34 AM
Manu
+ 2
well explained in sololearn in section Basic Concepts/Assignment & Increment Operators but Manasa Daddala also hit it in short rep++ :)
6th Jul 2016, 5:41 PM
Moersy
Moersy - avatar
0
x++ takes the variable and adds 1 to it. ++x adds one to the variable. EDIT: To see the difference you can look at my example. http://www.sololearn.com/app/csharp/playground/cOy3N6yTk2I3/
6th Jul 2016, 10:34 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar