Intersection of two linked list

What’s wrong with my code??
I have followed the steps given in the hints but still getting the error.

hello @div_yanshu07

image

after while loop (in line 26 and 31 ) ur head1 and head2 will be null.

so cannot use them after that while loop (they will give segmentation fault becuase they are null).

so reinitialise them with l1 , l2 after the while loop.

image

here condition should be
while(head1!=NULL && head2!=NULL)