What I specifically want to do is have a for loop iterating through the board array and when it reaches the one that the user has inputted, it replaces its value (the number on the board) with an X, so that the user has placed an X on the Tic Tac Toe board. I have set up the for loop the way I thought that it should be done, but I have left out the result of the loop and replaced it with comments.
#include <stdio.h>
int main()
{
int tLeft = 0;
int tMid = 1;
int tRight = 2;
int mLeft = 3;
int mMid = 4;
int mRight = 5;
int bLeft = 6;
int bMid = 7;
int bRight = 8;
int userChoice, compChoice, i;
int board[10] = {
tLeft, tMid, tRight,
mLeft, mMid, mRight,
bLeft, bMid, bRight
};
printf("[%d][%d][%d]\n", tLeft, tMid, tRight);
printf("[%d][%d][%d]\n", mLeft, mMid, mRight);
printf("[%d][%d][%d]\n", bLeft, bMid, bRight);
printf("Enter the number you would like to place an X at: ");
scanf("%d", userChoice);
for(i = 0; i < 9; i++)
{
if(board[i] == userChoice)
{
// MAKE BOARD[i] EQUAL TO X. THE PROBLEM WITH THIS IS THAT
// BOARD[i] IS TYPE INT AND 'X' WOULD BE TYPE CHAR AND I
// MIGHT SOUND LIKE A HUGE NOOB BUT I JUST STARTED CODING
// IN C HALF AN HOUR AGO.
}
}
return 0;
}