I'm writing a small battleship game in C. I have a player structure :
struct player{
char field[X][Y];
...
}
And I have function print_field:
void print_field(char *field[X][Y]){
for(int i = 0; i < X; i++){
for(int j = 0; j < Y; j++){
printf(" %c ", *field[i][j]);
}
printf("\n");
}}
X and Y are defined, both equals to 5;
What is the right way to pass field to print_field in main?
int main(){
struct player player1;
print_field(???);
...}
For now
print_field(&player1->field);
Gives me: warning incompatible pointer type [-Wincompatible-pointer-types]