Q: If I'm not using the value of the expression, should I use ++i or i++ to increment a variable?
A: Since the two forms differ only in the value yielded, they are entirely equivalent when only their side effect is needed. (However, the prefix form is preferred in C++.) Some people will tell you that in the old days one form was preferred over the other because it utilized a PDP-11 autoincrement addressing mode, but those people are confused. An autoincrement addressing mode can only help if a pointer variable is being incremented and indirected upon, as in
register char c, *cp; c = *cp++;See also question 3.3.
K&R1 Sec. 2.8 p. 43
K&R2 Sec. 2.8 p. 47
ISO Sec. 18.104.22.168, Sec. 22.214.171.124
H&S Sec. 7.4.4 pp. 192-3, Sec. 7.5.8 pp. 199-200