Node* findIntersection(Node* head1, Node* head2)
{ Node* dummy=new Node(0);
Node* p=dummy;
Node* temp1=head1;
Node* temp2=head2;
while(temp1!=NULL){
while(temp2!=NULL){
if(temp2->data==temp1->data){
p->next=new Node(temp1->data);
p=p->next;
}
temp2=temp2->next;
}
temp1=temp1->next;
}
return dummy->next;
}
The code is showing any output help