Edit One:
Thank you everyone for all of your responses and suggestions. All of you have been very helpful! I'm in the midst of redoing the program and incorporating many of the suggestions posted. I will make another edit to my post with the updated code soon! Edit Two:
I've been trying to rewrite this code for about 2 hours. A lot of what I've changed has been successful however I am stumped for one section I'm trying to write. My issue is that statements near the end of my while-loop are executing before statements above it. Here is the code:
int startGame() { bool winner = false; printf("\n\nHere is your playing board. Player One is Os and Player Two is Xs\n"); printf("Entering a number 1-9 (then pushing enter) as shown below will use\nthe current Player's turn in that location.\n"); printBoard(); int j=0; char token; char turn; do { scanf("%1c",&turn); token = (j % 2 == 0) ? 'O' : 'X'; if (turn=='1') { board[0][0] = token; printBoard(); } if (turn=='2') { board[0][1] = token; printBoard(); } if (turn=='3') { board[0][2] = token; printBoard(); } if (turn=='4') { board[1][0] = token; printBoard(); } if (turn=='5') { board[1][1] = token; printBoard(); } if (turn=='6') { board[1][2] = token; printBoard(); } if (turn=='7') { board[2][0] = token; printBoard(); } if (turn=='8') { board[2][1] = token; printBoard(); } if (turn=='9') { board[2][2] = token; printBoard(); } printf("\n%d",j); printf(" %c",token); } while (j<9 && winner == false); return 0; } The 2 printf statements at the end execute before I have time to input a value for turn. If I continue entering values in the program, j increments twice making token's value always 'X'. I feel like I'm missing something very obvious ._.