This is a fragment of a ticktacktoe game that I started. When I compile it, the Wint conversion warning pops up, saying that clear_table(board); and display_table(board); are making integers from pointer without a cast. I'm really new at C and I'm not sure how to fix this. Plus I'm not allowed to change the main function at all.
#include <stdio.h>
#define SIZE 3
void display_table(char board);
void clear_table(char board);
int main()
{
char board[SIZE][SIZE];
int row, col;
clear_table(board);
display_table(board);
return 0;
}
void clear_table(char board) {
int row = 0, col = 0;
for(row = 0; row < SIZE; row++) {
for(col = 0; col < SIZE; col++) {
board = '_';
}
}
return;
}
void display_table(char board) {
printf("The current state of the game is: \n");
int row = 0, col = 0;
for(row = 0; row < SIZE; row++) {
for(col = 0; col < SIZE; col++) {
printf("%c ", board);
}
printf("\n");
}
return;
}
Please help?
char boardcan hold only one singlecharvalue. Yet, you feed those routines with achar *.boardis a 2D char array, not acharcharthough.