mirror of
https://github.com/sdiehl/write-you-a-haskell.git
synced 2024-09-11 19:47:31 +03:00
18 lines
263 B
C
18 lines
263 B
C
#include <stddef.h>
|
|
|
|
typedef struct T
|
|
{
|
|
enum { NONE, SOME } tag;
|
|
union
|
|
{
|
|
void *none;
|
|
int some;
|
|
} value;
|
|
} Option;
|
|
|
|
int main()
|
|
{
|
|
Option a = { .tag = NONE, .value = { .none = NULL } };
|
|
Option b = { .tag = SOME, .value = { .some = 3 } };
|
|
}
|