From bf8af6c4697cf380445bc028109200d3a4cf288c Mon Sep 17 00:00:00 2001 From: loshprung Date: Wed, 29 Jan 2020 11:31:57 -0800 Subject: Post-class 01/29 --- 01-24.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to '01-24.md') diff --git a/01-24.md b/01-24.md index 67a9792..2f98b10 100644 --- a/01-24.md +++ b/01-24.md @@ -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) -- cgit