write-you-a-haskell/chapter10/adt.c
2015-12-13 13:58:00 -05:00

17 lines
205 B
C

typedef union {
int a;
float b;
} Sum;
typedef struct {
int a;
float b;
} Prod;
int main()
{
Prod x = { .a = 1, .b = 2.0 };
Sum sum1 = { .a = 1 };
Sum sum2 = { .b = 2.0 };
}