Giving me error(segmentation fault)

can you please edit this code ?

@premang
There are lot of mistake in your code. I am pointing out those mistakes

  1. line no. 56 should be while(fast!=NULL && fast->next!=NULL) { , It might be possible that fast->next is NULL so fast->next->next would not exist.
  2. In function merge(), if(a==NULL) return b; and when if(b==NULL) return a;
  3. In function merge_sort() base case should be if(head->next==NULL || head==NULL) { return head; }
  4. line 103 should be a=merge_sort(a);
  5. line 104 should be b=merge_sort(b);

@premang
here is the updated code as per above changes

1.First point is incorrect according to this,

In https://online.codingblocks.com/app/player/42363/content/98094/568/lecture
at time stamp 7:03 sir did the same.

i modified the code
still not working