Hey all, im trying to write a program to create a small tic tac toe game (command line). im trying to make it using seperate functions for each process (such as to clear the board, or print the board). im fairly new to c and everytime i try to run my program i am given an output of a 3x3 matrix of /374/374/374 for every row. so far i am only trying to print a 3x3 matrix of all dashes.
PS. i keep getting a warning saying" warning assignent makes integer from pointer without a cast". i have no idea what this means so if someone could explain it thatd be great.
Output---Code:#include <stdio.h> #include <stdlib.h> #define ROW 3 #define COL 3 #define TRUE 1 #define FALSE 0 void printboard (char b[ROW][COL]); void clearboard (char b[ROW][COL]); void play(char b[ROW][COL], char player); int checkwinner(char b [ROW][COL]); char testrow(char b[ROW][COL]); char testcols(char b[ROW][COL]); char testdiag(char b[ROW][COL]); int testdraw(char b[ROW][COL]); int main(){ char board[3][3]; clearboard(board); printboard(board); return 0; } void clearboard (char b[ROW][COL]){ int row, col; for (row=0; row<3; ++row){ for (col=0; col<3; ++col){ b[row][col] = "-"; } } } void printboard(char b[ROW][COL]){ int row, col; for (row=0; row<3; ++row){ for (col=0; col<3; ++col){ printf ("%c",b[row][col]); } printf("\n"); } }
\374\374\374
\374\374\374
\374\374\374