Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
(i++) returns a number, a constant, to put it simply. Which cannot be incremented because it is not a variable
(++i) returns a reference to a variable that can be incremented again.
for example, ++(++i) - you can. (i++)++ - you can't.
++i - increment a variable and return it. The result of this expression is the variable itself, you can apply any other operations on it that are valid for the variable. For example, postfix increment.
i++ - return the value of a variable and then increment it. The result of this expression is not a variable, but its past value. You cannot perform operations with it that require a variable. For example, prefix increment.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question