Doubts in " Intersection point two linked lists"

My code show run time error. Please tell me the mistake in my code.

I have edited your code a bit, now it is producing correct output for sample test case, kindly refer to it,

Please can you tell me why there is no need of “head=head->next”.

This is because if you are given different numbers in linked list, you should always use insertAtTail function, which will automatically creates and add nos, at the end, thus there is no need to write
head=head->next;
I hope you understood the approach.