My code got an error below:
incompatible types when assigning to type enum cell from type enum cell *
I have tried many ways to fix it but didnt work. This is my code:
BOOLEAN init_first_player(struct player * first, enum cell * token) {
strcpy(first->name, "Bob");
first->score = 0;
int colorNo = rand() % 2;
token = (colorNo + 1 == 1) ? RED : BLUE;
first->token = token; //Error occurs here
return TRUE;
}
this is my data structure:
struct Player {
char name[20];
enum cell token; //takes 0 - 1 - 2
unsigned score;
};
enum cell {
BLANK, RED, BLUE
};
Someone can please fix the code as I don't know what I have been doing wrong.
enum cell * tokento the function when all you do with it is use it like a local variable?init_first_player()called, what are you passing and how are those values defined and initialised?