Your variables have no assigned values:
int i ;
int h ;
Now, the compiler knows that i
will be assigned a value here:
for( i = 0 ; i< 8 ; i++)
Without looking too deep under the hood, basically the i = 0
part is guaranteed to happen whether the loop body executes or not. Then we know that h
will also be assigned a value here:
for( h = 0 ; h< 8 ; h++)
Because we know that the outer loop will execute at least once, because we know 0 is less than 8. But the compiler isn't as aware of this. The compiler follows a simpler set of rules for the guarantees that it makes. And those rules do not include executing the program's logic to see if something will or won't happen.
So the bottom line is that, while the compiler can guarantee that i
will be assigned a value, it can not guarantee that h
will. Hence the error.
The simple solution is just to assign values to your variables:
int i = 0;
int h = 0;