I have the following code:
I get the following errors:Code:
#include <stdio.h>
#include <stdlib.h>
int max_rows;
int max_columns;
void print(char[][]);
int main(int argc, char *argv[]){
max_rows = 3;
max_columns = 3;
char grid[max_rows][max_columns];
for(int i = 0; i < max_rows; i++){
for(int j = 0; j < max_columns; j++){
grid[i][j] = 'X';
}
}
print(grid);
}
void print(char grid[max_rows][max_columns]){
for(int i = 0; i < max_rows; i++){
for(int j = 0; j < max_columns; j++){
printf("%c ", grid[i][j]);
}
printf("\n");
}
}
error: array type has incomplete element type (line: void print(char[][]);)
In function ‘main’:
error: type of formal parameter 1 is incomplete (line: print(grid);)
Any ideas???