Increment and decrement operators are available in 2 forms: postfix and prefix. The difference between them is that the postfix operator is executed after the expression is evaluated, but prefix - before it is evaluated. Thus, the line with a postfix expression var ++ will result in the original value of the variable var (1), and the one with a prefix expression - the new value of given variable (3).
Because of that, when comparing the values of expressions var1++ and ++var2 - they will not be equal.
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать