How this syntax works??Code:#include <stdio.h>
typedef enum {
GREEN = 0,
BLUE
}COLOR;
typedef struct{
COLOR color;
}COLORS;
int main()
{
COLORS c;
c.color = 0;
}
how assigning value to color changes enum
Printable View
How this syntax works??Code:#include <stdio.h>
typedef enum {
GREEN = 0,
BLUE
}COLOR;
typedef struct{
COLOR color;
}COLORS;
int main()
{
COLORS c;
c.color = 0;
}
how assigning value to color changes enum
Err... that's how enums work, although you should use GREEN instead of 0 since that's why you declared the enum in the first place.