How to store a linked list in a struct in C

Posted by LuckySlevin on Stack Overflow See other posts from Stack Overflow or by LuckySlevin
Published on 2010-05-13T12:01:43Z Indexed on 2010/05/13 12:04 UTC
Read the original article Hit count: 228

Filed under:
|
typedef struct child_list {int count; char vo[100]; child_list*next;} child_list;
typedef struct parent_list
{ char vo[100];
child_list * head;
int count;
parent_list * next; } parent_list;

As you can see there are two structures. child_list is used to create a linked list. And this list will be stored in a linked list of parent list. My problem is to display the child list which in the parent_list.

My desire to get while displaying the linked list of parent_list:

This lists work with this logic. I already made append and other stuff.

For example if i enter ab cd ab ja cd ab

Word    Count    List

ab        3      cd->ja

cd        2      ab->ab

ja        1      cd

The problematic part is displaying child_list which is in the parent_list nodes(List column of output). I don't know my question is clear please ask for further info.

© Stack Overflow or respective owner

Related posts about linked-list

Related posts about c