I don't want to sound mean, but you still have such a crazy amount of redundacy in your code that it kind of leaps out at you. I think you are going to have trouble getting very far with this until you can spot that.
When tabstop writes:
I don't think s/he just meant that you needed to renumber the case statements because seven of them were identical. S/he meant that you might as well COMPLETELY ERASE THE ENTIRE SWITCH CASE STATEMENT and do this:
But there's the O's too! So maybe:Code:if (board[choice-1]=='X') printf("That space is taken,choose anohter");
And to make use of the drawBoard function, you do this:Code:if (board[choice-1]=='X' || board[choice-1]=='O') printf("That space is taken,choose anohter");
Another example of redundancy would be in the getXorO function, you ask for a choice, include some error checking, and then include a while loop to catch bad choices that does exactly the same thing. If you initialize intialChoice to zero, all you need is the while loop, because 0 !=1 and 0 !=2. While we are there, maybe it's unnecessary to cancel my game because I hit the wrong key, so -- your choice -- you could change the if a bit:Code:void drawBoard(char *board){
printf("\n");
printf("\t %c | %c | %c \n",board[0],board[1],board[2]);
printf("\t---|---|--- \n");
printf("\t %c | %c | %c \n",board[3],board[4],board[5]);
printf("\t---|---|--- \n");
printf("\t %c | %c | %c \n\n",board[6],board[7],board[8]);
return;
}
// of course invoke it with:
drawBoard(board);
Anyway, while I don't mean to just "tell you what to do", consider who you want repairing your car:Code:int getXorO(void){//player decides to be X or O here and returns the initialChoice to main
int initialChoice=0;
printf("Let's play TIC-TAC-TOE!\n\n");
while(initialChoice!=1 && initialChoice!=2){
printf("Do you want to be X or O (X moves first)? \n");
printf("Enter 1 for X and 2 for O:");
if(scanf("%i",&initialChoice)==1) break;
}
return initialChoice;
}//getMove returns initialChoice to be X or O
1) an abstract expressionist
2) a mechanic
Try and rework what you've got down to about 50 lines and you will be in a much better position. It may seem like a tedious difference now, but it won't be if you multiply the size of your program by five or ten (or twenty, or as much as you like). You are also unlikely to find any performance advantages going the long route.

