Can I do something like this? I would like to use data types instead of constants in my enum type_t.
typedef struct {
char id;
long data;
} type1_t;
typedef struct {
char id;
long data;
float moredata;
} type2_t;
typedef enum {
type1_t, type2_t
} type_t;
typedef struct {
type_t type;
char* something;
} midas;
midas obj1;
obj1.type = type1_t;
obj1.type.id = 0;
obj1.type.data = 123;
midas obj2;
obj2.type = type2_t;
obj2.type.id = 3;
obj2.type.data = 456;
obj2.type.moredata = 3.14;
In the example the type variable of the midas struct should then refer to type1_t or type2_t. So if I set the type to type2_t, the size of it should be bigger than when I set type1_t.