Examples of Union in C [closed]
One classic is to represent a value of “unknown” type, as in the core of a simplistic virtual machine: typedef enum { INTEGER, STRING, REAL, POINTER } Type; typedef struct { Type type; union { int integer; char *string; float real; void *pointer; } x; } Value; Using this you can write code that handles … Read more