I am trying to create a linked list, with two seperate lists in one structure. That is, it holds a 'name' and a 'age' value. Then the program can either output the list sorted by name, or sorted by age. So i need two linked lists, essentially.
However, i need the program to be aware of the root/head of both the name list and the age list.
I'm not sure how to send this to my function.
I will already have the name and the age I want to add to each list, and then somehow I have to send it the head of each list. Because there is two heads i want to return, i cant use the return function. How can I make my main aware of the changes to the head/root lists?
Hopefully the question is clea, and thanks for the answers!