Search code examples
clinked-listmergesort

calling merge sort of my linked list on my main


I'm new to C and I have a question to ask.

I am creating a linked list that has this struct:

 struct node
 {
      char data[100];
      struct node *previous;  // Points to the previous node
      struct node *next;   // Points out to the next node
 }*head, *last;

And I'm asked on my code to add a function to sort my list as well. I used a code called merge sort algorithm to test and understand it's function. Now I would like to call it on my main but don't know how.

This is my function name:

struct node *merge_sort(struct node *head)

Now if let's say I call it on my main() how should I do that? let me know if I'm not asking the question well.

Thanks


Solution

  • The call will be like,

    merge_sort(head);