@JustMike . . . A FEW C EXAMPLES: . . . to accompany the Java ones.
NON-NESTED loop: . . . limiting scope where possible
/*LOOP_DESCRIPTION*/ {
int i;
for (i = 0; i < LOOP_LENGTH; i++) {
// loop body
}
}
NESTED loop: . . . ditto
/*LOOP_DESCRIPTION*/ {
int row, column;
for (row = 0; row < ROWS; row++) {
for (column = 0; column < COLUMNS; column++) {
// loop body
}
}
}
One good thing about this layout is it reads badly without comments, thereby encouraging them.
It's verbose perhaps, but personally this is how I do loops in C.
Also: I did use "index" and "idx" when I started, but this usually got changed to "i" by my peers.