How to set the value of a structure enum member

Structural code that causes problems

typedef struct gamer
{
    char name[MAXNAME];
    Cell token;
    unsigned score;
} Gamer;

      

Enumeration

typedef enum cell
{
    BLANK, RED, CYAN
} Cell;

      

When I try to set the value of a member of my structure Cell

, I use this code;

 gamer1->Cell = RED;

      

however, when compiling, it gives me this error;

error: 'Gamer' has no member named 'Cell'". Thanks in advanced.

      

+3


source to share


1 answer


What you should do gamer1->token = RED;

token

is a member of the structure, not Cell

.



+7


source







All Articles