Why this code is getting error

@Jun18APP0112
hello gurdeep,
pls share correct code link,the link u shared is not of merge sorted linked list. pls share correct link

@Jun18APP0112
hello gurdeep,
in ur megre function,

the highlighted part should be out of ur while loop. and in place of head=head->next ,it should be head1=head1->next and head2=head2->next;