Segmentation Fault in LL MergeSort

Segmentation Fault in LinkedList MergeSort.
the link of my code:

Hey @sanjit_15
Your code works completely fine. Give an input and try running it. it works fine.

Its giving a segmentation fault. I am attaching a screenshot.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

I am still having the same issue of segmentation fault : core dumped.

Hey @sanjit_15


it’s showing correct output now, just do a little change in your while loop in midpoint function
the while loop condition should be:
while(slow!= NULL && fast!=NULL && fast->next!=NULL)
{
fast = fast->next->next;
slow = slow->next;
}