Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The counter variable i is declared outside of the for loop. This goes against this recommendation because it is not declared in the block in which it is used. If this snippet were reused with another index variable j, but there was a previously declared variable i, the loop could iterate over the wrong variable.

Code Block
bgColor#ffcccc
langc
public void doStuff(...){
  size_t i = 0;

  for (i=0; i < 10; i++){
    /* Perform operations */
  }
}

...