0
Good evening. I have to do a program where I have to create several elements using the following:
typedef enum {ATRIB, ADD, SUB, MUL, IF_I, PRINT, READ, GOTO_I, LABEL} OpKind;
typedef enum {EMPTY, INT_CONST, STRING} ElemKind;
typedef struct{
ElemKind kind;
union{
int val;
char *name;
} contents;
} Elem;
typedef struct{
OpKind op;
Elem first, second, third;
} Instr;
However, I am failing to see how to assign values to each of the elements of Instr
.
Can anyone give a simple example of how I can do the assignment?
Thank you
Something like: Instr.first.Kind = EMPTY;
– anonimo
Thanks made it clear
– Fábio Silva