#include <stdio.h>
int main (void){
char board[3][3];
printf("Enter X or O>");
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
scanf("%c", &board[i][j]);
}
}
printf("Board: ");
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
printf("%c ", board[i][j]);
}
printf("\n");
}
}
/* X O X
O X O
X O O
*/
I'm trying to make a 3x3 tic tac toe board using 2D arrays in C. This code works fine for an Int array but doesn't work as expected using char. How can I fix this?