ProAnswers.org

What is the difference between ++i and i++?

1 Like

++i is the pre-increment, in which the value of variable (i) is incremented before checking the condition…its not dependent on condition, whether it is true / false. when the loop is started, it’ll increment the value of i by 1.

i++ is the[b] post increment[/b], in which the value of variable (i) is incremented by 1 after checking the condition....if the condition is true, then only value of variable(i) will be incremented by 1 otherwise not.