3 ms·
I just flicked through my copy of K&R (second edition), and at the beginning it clearly prefers preincrement. The introduction of for loops comes before that of
by gsg 13y ago
I just flicked through my copy of K&R (second edition), and at the beginning it clearly prefers preincrement. The introduction of for loops comes before that of ++, and the first for loop in the book is actually
for (fahr = 0; fahr <= 300; fahr = fahr + 20)
...
Each for loop after the introduction of ++ uses preincrement (where applicable) for a while, and then the style shifts to postincrement.
EDIT: specifically, increments are deliberately prefix ("For the moment we will stick with the prefix form") until the full introduction of increment and decrement operators in section 2.8, after which they are postfix.