My Struct Definitions.
typedef struct inner_list {char word[100]; inner_list*next;} inner_list;
typedef struct outer_list
{ char word [100];
inner_list * head;
outer_list * next; } outer_list;
And The problem part:
void append(outer_list **q,char num[100],inner_list *p)
{ outer_list *temp,*r;
temp = *q;
char *str;
if(*q==NULL)
{ temp = (outer_list *)malloc(sizeof(outer_list));
strcpy(temp->word,num);
temp->head = p;
temp->next=NULL;
*q=temp;
}
else
{ temp = *q;
while(temp->next !=NULL)
{ temp=temp->next;
}
r = (outer_list *)malloc(sizeof(outer_list));
strcpy(r->word,num);
temp->head = p;
r->next=NULL;
temp->next=r;
}
}
I don't know what is i'm doing wrong in this append function i'm sending a char array and a linked list to be stored another linked list. But i can't store the linked list in another linked list. I couldn't figure out the problem. Any ideas?