For loop into a function

It is conventional to start the loop counter at 0 if it is only used to repeat the body of the loop. Like this:

   // Repeat 5 times
    for (int i = 0; i < 5; i++) {