Difference between i++ and ++i in C

Published on October 1st, 2019

c icon

I am sure there was at least one time you’ve wondered why does C have i++ and ++i operators. Me too. That’s why I’ve made this article.

i++ is also called post Increment whereas ++i is known as pre Increment and, as you probably already concluded, they both increment variable. Difference is in the value that it returns.

  • Post increment (i++) returns the value, and then increments it.
  • Pre Increment (++i) increments the value, then returns it.

And that is all there is to it!