for (int i = 0; i < numSections; i++); {
The problem is the last semicolon on that line. It ends the
for
statement and the scope of the variable
i
is limited to that
for
statement so it falls out of scope after the semicolon and is no longer defined.
This will work better :
for (int i = 0; i < numSections; i++) {