I have a tic tac toe board i am finding it hard to figure out how to change parts of the array that contains char. I am looking for a way to to ask the user to select a char to change in the the array and then once they input their answer it replaces the char with the new input by the user.

char[] tic = {'1', '2', '3', '4', '5', '6', '7', '8', '9'};

um, tic[index] = someChar?

it's a tic tac toe board so i need to figure out how to take the number char from the tic array after asking the user where he wants to play and then replace his choice with either an 'x' or an 'o'.

Yes, you said that already in your first post. Just repeating yourself isn't helpful.

What exactly is it that you are stuck on? Is it asking the user? Getting the number from the user? Putting an 'x' or 'o' in the array (that one was answered by masijade already)? Something else?

Member Avatar

If the user inputs "5", you replace the fifth element (4) with either the "X" or "O".
Again...(that one was answered by masijade already).

thank you, i was just thinking about using the actually input as the replacement instead of using the userinput as the index.
tic[userinput - 1] = player; //in this case player = 'X';