Why this one's not giving correct output?

Why this one’s not giving correct output?

@cbcao263
You missed to decrement d in while loop. Just write d–; after b=b->next. Also why are you moving b pointer ahead. You need to move that pointer whose length is larger. So add if(l1>l2){ a=head2; b=head; } after line no. 80. 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.