+ 1
whats the difference x++ and ++x? can anyone ?
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.
+ 2
well explained in sololearn in section Basic Concepts/Assignment & Increment Operators but Manasa Daddala also hit it in short rep++ :)
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/