Last active
August 29, 2015 14:10
-
-
Save theQuazz/c2eda7fdd365b272defd to your computer and use it in GitHub Desktop.
crazy unions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum student_t { | |
| STUDENT, | |
| GRADED_STUDENT | |
| }; | |
| struct Student { | |
| char *name; | |
| }; | |
| struct GradedStudent { | |
| struct Student student; | |
| int grade; | |
| }; | |
| struct DynamicStudent { | |
| enum student_t student_type; | |
| union { | |
| Student student; | |
| GradedStudent graded_student; | |
| }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment