diff options
Diffstat (limited to '01-24.md')
-rw-r--r-- | 01-24.md | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -22,7 +22,7 @@ union union_t{ Alternatively, you can use `typedef`: ``` -typedef union{ +typedef union union_t{ variable declaration; variable declaration; ... @@ -34,7 +34,7 @@ Both examples above are type definitions and do not allocate memory Union Example: ``` -typedef union{ +typedef union art_info{ int age; char artist[20]; } ART_INFO; @@ -81,12 +81,12 @@ info_array[0].age = 1000; - Union example in a Structure: ``` -typedef union{ +typedef union art_info{ int age; char artist[20]; } ART_INFO; -typedef struct{ +typedef struct art_class{ char name[20]; int class; ART_INFO info; @@ -100,3 +100,7 @@ ART_CLASS class_array[4] = ``` - Be careful not to reference an invalid member in your union! + +--- + +[-> Notes 01/29](01-29.md) |