Now I don't understand why malloc isn't working

typedef union
{
int64_t int_d;
double number_d;
} Token_data;

typedef struct
{
Token_type type;
Token_data data;
} Token_t;

Token_t *my_token = (Token*) malloc(sizeof(Token_t))

@matrix apart from you casting to Token instead of Token_t, that looks fine.
Follow

@apropos @matrix And the cast is homosexual to begin with

· · Web · 0 · 0 · 1
Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.