Hi,
I don“t get why I get this warning, since the array cannot be bigger then 7x7!
#include<stdio.h>
#define N 7
int main(void)
{
char CheckerBoard [N][N];
int row, col;
for(row = 0; row < N; row++);
for(col = 0; col < N; col++);
if ((row+col)/2 == row)
CheckerBoard[row][col] = 'B';
else
CheckerBoard[row][col] = 'R';
return 0;
}
I also tried it with a while loop but kept the same error!
grtz!
Very simple error!
Take a very close look at the (end of the) for() loop statements... ;)
Ralf
Ah thx I see it now! :-[
Quote from: sannemander on May 02, 2012, 07:25:58 PM
Ah thx I see it now! :-[
You're welcome! 8)
Just as a tip, which helps IMHO to avoid such quirks, is to getting used to start writing such a statement as a template like
for(;;){};
and then fill out the "inner" parts.
The braces help to determine the scope of the for() loop and also in placing the terminating semicolon in the right place...
Ralf