/* File: declarations.c Different ways of defining new data types. */ #include #include "genlib.h" #include "simpio.h" /* Method 1 */ enum veg_tag {carrots, beets, squash} ; typedef enum veg_tag veg_type ; /* Method 2 */ enum {red, white, blue} stars, stripes ; /* Method 3 */ typedef enum {orange, yellow, violet} color_type ; /* Method 4 */ typedef enum green_tag {green, teal, aquamarine} green_type ; main() { enum veg_tag veg1, veg2 ; veg_type veg3, veg4 ; color_type c1, c2 ; green_type g1, g2 ; enum green_tag g3, g4 ; veg1 = veg2 = carrots ; veg3 = veg4 = carrots ; stars = white ; stripes = red ; c1 = c2 = yellow ; g1 = g2 = teal ; g3 = g4 = aquamarine ; }