#include int main() { //enum--------------------------------------- typedef enum color{RED,ORANGE, YELLOW, GREEN, BLUE, PURPLE, BLACK, WHITE}Color; enum colorHex{ WEISS=0xffffff, SCHWARZ=0x000000, GRAU=0x0f0f0f, }; printf("Weiss:%d(dezimal) %x(hex)\n",WEISS, WEISS); //Array----------------------------------------------- Color liste[]={BLACK, WHITE}; int length =sizeof(liste)/sizeof(int); printf("Liste mit %d Elementen, f??ngt mit %d an\n",length, liste[0]); //struct------------------------------------ typedef struct colordef{ unsigned char r; unsigned char g; unsigned char b; }colorDefinition; colorDefinition black={0,0,0}; colorDefinition blue ={.b=255}; printf("Red Wert von black: %d\n",black.r); //union------------------------------------------- typedef union customColorDef{ struct rgb{ unsigned char r; unsigned char g; unsigned char b; }rgb; int hex; }customColorDef; customColorDef schweinchenRosa={.hex=0xffb6c1}; printf("Schweinchenrosa: %x\n",schweinchenRosa.hex); customColorDef navy={0,0,128}; printf("navy %x(hex)\n",navy.hex); printf("navy %d (RGB)\n",navy.rgb.b); //Array length mit struct typedef struct colorarray{ const int length; Color content[6]; }ColorArray; ColorArray rainbow={ .content={RED,ORANGE, YELLOW, GREEN, BLUE, PURPLE}, .length=6 }; printf("Der Regenbogen hat %d Farben\n", rainbow.length); return 0; }