# Thread: Creating a list with elements other lists (same struct)

1. ## Creating a list with elements other lists (same struct)

Lets say i have 3 lists : list1,list2,list3.
Their struct of each element of those lists :
Code:
```struct node {
char value[20];
struct node * next ;
int occurs;
};```

Code:
```typedefstruct node Node;
typedefNode*List;```

but i dont think it matters.
I want to create a new list but every element of it has to be each of those 3 lists.My new struct for this matter is that(its correct):
Code:
```typedefstruct listoflists{
Listlist;
struct listoflists*next;
}Nested;```

My new function to make the list :
Code:
```void createlistoflists(Nested**LIST,List list1,List list2,List list3){
if(*LIST==NULL){
*LIST=listab;
}
else```

So im not sure if the begging is even correct but how will i fill it(and correct) in order to achieve the list of lists?

2. So what does the result look like?
Code:
```If you have
list1 -> a -> b -> c
list2 -> d -> e -> f
list3 -> g -> h -> i

Is your combines list like this
combined -> a -> b -> -> d -> e -> f -> g -> h -> i

Or like this
combined
|
V
list1 -> a -> b -> c
|
V
list2 -> d -> e -> f
|
V
list3 -> g -> h -> i

Or something else?```
Are you making copies of list1,2,3 or removing the elements to put them in the new list?

3. The 2nd scenario for how the list should be. All it asks is a list with elements the lists 123,otherwise it would say list with elements the elements of lists 123 right?Now for the 2nd question i think it should be copies because it would say new lists 123.Its actually not clear
Also look at the struct i set for the listoflists(its how it has to be done).
And it has to be done in one function.

4. Well this would be a better prototype, which you call 3 times.

Code:
`Nested *createlistoflists(Nested*lol,List list);`
Which you call as
Code:
```Nested *lol = NULL;
lol = createlistoflists(lol,list1);
lol = createlistoflists(lol,list2);
lol = createlistoflists(lol,list3);```
You can rename this particular function, then make your given prototype make those three calls as above.