Assign constant char to another char variable
Hi all,
I'm having trouble with my project (connect 4). At the beginning of the program I define 2 constants char that represents black checker and red checker as follows:
#define RED 'X'
#define BLACK 'O'
I have a menu() function that prints out welcome to the game, stuff like that. I then proceed to ask the user which color he would like to be, then assign it to one of the constant char (RED or BLACK) appropriately as follows:
Code:
int choice;
char player;
char com;
scanf("so you wan to be... %d \n", &choice);
if (choice == 1) {
player = RED;
com = BLACK;
}
else if (choice == 2) {
player = BLACK;
com = RED;
}
I then prints out char player and char com to confirm that I have assigned the values correctly:
printf("the player chose to be: %c\n", player);
but this only prints out "the player chose to be: "
what am I doing wrong here ? Any suggestion would be greatly appreciated. Thanks in advance everyone !