You are viewing a single comment's thread.

view the rest of the comments →

0
0

[–] RevanProdigalKnight ago  (edited ago)

Just in case you didn't already know, there is actually a difference between counter++ and ++counter, as the first increments after reading the value and the second before reading the value, e.g.:

int counter = 0;

printf("%d\n", counter++); // 0
printf("%d\n", ++counter); // 2

Most people use counter++ because of this behavior being closer to the logical alternative of counter += 1.