Solution:
|
You
must have something like the following:
for (int i=0; i < 7; i++) { // for loop body }
// You use i outside of the loop, e.g. i = 43;
The problem is that the scope of i in the above example is restricted
to the body of the for loop in g++. So if you want to use the
variable i outside of the for loop, you will have to define it outside
the for loop. It would look something like this:
int i; for (i=0; i < 7; i++) { // for loop body }
// You use i outside of the loop, e.g. i = 43;
|