I tried to merge two sorted linkedlist but my code is not working

node * merge(node *a,node *b)
{
if(a==NULL)
return b;
else if(b==NULL)
return a;
node *c;
if(a->datadata)
{
c=a;
c->next=merge(a->next,b);
}
else
{
c=b;
c->next=merge(a,b->next);
}
return c;
}

Maybe this function to merge two sorted linked lists will help.

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.