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
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.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)