I try to fill the content of a union with something, however I receive an error. here's the code:
struct command
{
int type;
int *input;
int *output;
union{
struct command *command[2];
char **word;
}u;
};
typedef struct command *command_t;
command_t read_command(){
command_t main1 = NULL;
command_t main2 = NULL;
main1->u->word = (char**)malloc(1);
main1->u->word[0] = (char*)malloc(1);
//some other code in here
}
I got an error in "main1->u->word = (char**)malloc(1);" line saying: "invalid type argument of â->â (have âunion â)"
any suggestion? thx