노조의 내용을 무언가로 채우려 고 시도하지만 오류가 발생합니다. 여기에 코드가 있습니다 :노조의 내용을 채우는 데 오류가 발생합니다.
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
}
"main1-> u-> word = (char **) malloc (1);" 줄을 말하는 : "잘못된 유형 인수 â -> â (âUNION â)"
어떤 제안? thx
'main1-> u.word'를 사용하면'main1'을 얻기 위해'malloc'을 사용해야합니다. –