Difference between ++i and i++

There are lots of questions seen on the forum that what exactly does the ++ placement will to the concept. This is really is good question and if answered will be the best thing for the programmer to understand and implement.

Here is my perception on the subject provided.

++I is the pre-incremental value for I and I++ is the post-incremental value for I.


 ++i will increment the value of i, and then return the incremented value.

For instance: 
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.

For instance: 

i = 1;
j = i++;
(i is 2, j is 1)


 I hope this will help you to understand the basics of the operator overloading feature for + values.

Happy coding! 🙂

Leave a comment