What's the problem in my code

My code URL:

@lcs2019022
hey here n1 ans n2 can be 0. So if any of the linked list if empty then your code will give segmentation fault (Runtime error) since in line 191 you have check both head1->num and head2->num which would not exist in such case.
So change line 191 to 200 with these lines
if(head1!= NULL && head2!=NULL && (head1->num > head2->num))
{
head = head2;
temp2 = temp2->link;
head->link = NULL;
}else if(head1!=NULL){
head = head1;
temp1 = temp1->link;
head->link = NULL;
}
else if( head2!=NULL){
head = head2;
temp2 = temp2->link;
head->link = NULL;
}

@lcs2019022
your code will work

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.