diff options
author | loshprung <lshprung@scu.edu> | 2020-01-29 11:31:57 -0800 |
---|---|---|
committer | loshprung <lshprung@scu.edu> | 2020-01-29 11:31:57 -0800 |
commit | bf8af6c4697cf380445bc028109200d3a4cf288c (patch) | |
tree | f571a24291a33795c97b6cbdf2c9f450268b1b97 /01-24.md | |
parent | 7f939ea40a4451ab1320ac508d2922fc3b20ac19 (diff) |
Post-class 01/29
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) |