Quote:
I do not know if it is initialized correctly.
Although at the beginning of the simulation the grid is completely initialized with empty, afterwards the address of the grid is passed to a function:
generate_coords(grid);
In the function you do the following with the grid:
int count = 1;
for (int i = 0; i < xmax; i++) {
for (int j = 0; j < ymax; j++) {
red[i][j] = count++;
printf("%d ", red[i][j]);
}
}
I am not sure if you are really surprised that the grid is not empty anymore.
One more thing: Since the function has a return value, this should always be returned. After the call the caller should also do something with this value, otherwise it would be in vain. The compiler should also notice this if you specify the flags correctly when calling the function.
Warning: "generate_coords": Not all control paths return a value.