++i will increment the value of i, and then return the incremented value.
++i
i
i = 1; j = ++i; (i is 2, j is 2)
i++ will increment the value of i, but return the original value that i held before being incremented.
i++
i = 1; j = i++; (i is 2, j is 1)
Last updated 1 year ago