Is it legal to assign an int to an enum type as shown in c.color = 1? I ran this code and it does seem to set c.color to BLUE as BYE is printed, but I wanted to understand if this actually sets the enum correctly.
typedef enum {
GREEN = 0,
BLUE
}COLOR;
typedef struct{
COLOR color;
}COLORS;
int main()
{
COLORS c;
c.color = 1;
if(c.color == BLUE)
{
printf("BYE");
}
}