...
The counter variable i is declared outside of the for loop, which goes against this recommendation because it is not declared in the block in which it is used. If this snippet this code were reused with another index variable j, but there was a previously declared variable i, the loop could iterate over the wrong variable.
...
Complying with this recommendation requires that you declare variables where they are used, which improves readability and reusability. In this example, you would declare the loop's index variable i within the initialization of the for loop. This requirement was recently relaxed in the C standard.
...