> For the complete documentation index, see [llms.txt](https://huy312100.gitbook.io/software-development/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://huy312100.gitbook.io/software-development/everything-anyone-should-know/comparison/data-structures/i++-vs-++i.md).

# i++ vs ++i

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

  ```c
   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.

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