Code:#include <stdio.h> #include <stdlib.h> char setup_array(); void print_layout(char *numbers); void start_game(int players, char *numbers); int who_turn(int count); int play(); void reset(char *numbers); int main () { int players; char array [] = {'0','1','2','3','4','5','6','7','8','9'}; char *numbers; numbers = array; printf ("Please enter number of players: "); scanf("%d", &players); print_layout(numbers); start_game(players, numbers); return 0; } void print_layout(char *numbers) { printf ("---+---+---\n"); printf (" %c | %c | %c |\n",numbers[1], numbers[2], numbers[3] ); printf ("---+---+---\n"); printf (" %c | %c | %c |\n",numbers[4], numbers[5], numbers[6] ); printf ("---+---+---\n"); printf (" %c | %c | %c |\n",numbers[7], numbers[8], numbers[9] ); printf ("---+---+---\n"); } char setup_array() { return 0; } int play() { int play; printf("Please enter the number you would like to play: "); scanf("%d", &play); system("clear"); return play; } void start_game(int players, char *numbers) { char turn1 = 'X'; char play_again; int turn; int win = 0; int count = 1; if (players == 2) { while (win < 1){ if (who_turn(count) == 1) turn1 = 'X'; else turn1 = 'O'; numbers[play()] = turn1; print_layout(numbers); count ++; if ((numbers[1] == 'X' && numbers[2] == 'X' && numbers[3] == 'X') || (numbers[4] == 'X' && numbers[5] == 'X' && numbers[6] == 'X') || (numbers[7] == 'X' && numbers[8] == 'X' && numbers[9] == 'X') || (numbers[1] == 'X' && numbers[4] == 'X' && numbers[7] == 'X') || (numbers[2] == 'X' && numbers[5] == 'X' && numbers[8] == 'X') || (numbers[3] == 'X' && numbers[6] == 'X' && numbers[9] == 'X') || (numbers[1] == 'X' && numbers[5] == 'X' && numbers[9] == 'X') || (numbers[3] == 'X' && numbers[5] == 'X' && numbers[7] == 'X') ) { win = 1; } else if ((numbers[1] == 'O' && numbers[2] == 'O' && numbers[3] == 'O') || (numbers[4] == 'O' && numbers[5] == 'O' && numbers[6] == 'O') || (numbers[7] == 'O' && numbers[8] == 'O' && numbers[9] == 'O') || (numbers[1] == 'O' && numbers[4] == 'O' && numbers[7] == 'O') || (numbers[2] == 'O' && numbers[5] == 'O' && numbers[8] == 'O') || (numbers[3] == 'O' && numbers[6] == 'O' && numbers[9] == 'O') || (numbers[1] == 'O' && numbers[5] == 'O' && numbers[9] == 'O') || (numbers[3] == 'O' && numbers[5] == 'O' && numbers[7] == 'O') ) { win = 2; } } if (win == 1) printf("\n\nPlayer 1 Wins!!!!!!!!!!!!!!!!!\n\n"); else if (win == 2) printf("\n\nPlayer 2 Wins!!!!!!!!!!!!!!!!!\n\n"); } getchar(); printf("Do you want to play again (Y or N): "); scanf("%c", &play_again); if (play_again == 'Y' || play_again == 'y') { win = 0; count = 0; reset(numbers); } else exit(0); } int who_turn(int count) { if (count % 2 == 0) return 2; else return 1; } void reset(char *numbers) { char array [] = {'0','1','2','3','4','5','6','7','8','9'}; numbers = array; print_layout(numbers); start_game(2, numbers); }