Intersection Point of 2 Linked Lists

On submitting the code for this question,I am getting the following error:
source.cpp: In function ‘Node* intersectionOfTwoLinkedLists(Node*, Node*)’:
source.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
29 | }
| ^

LINK : https://ide.codingblocks.com/s/304639

Please help me resolve the error.

Pls edit the function you are using for the intersection point for linked list as :

int intersection(nodehead1,nodehead2,int N1,int N2)
{
int len1=N1;
int len2=N2;
int diff;
if(len2>len1)
{
diff=len2-len1;
}
else
{
diff=len1-len2;
}
if(len2>len1)
{
for(int i=0;i<diff;i++)
{
head2=head2->next;
}
}
else
{
for(int i=0;i<diff;i++)
{
head1=head1->next;
}
}
while(head1 != NULL && head2 != NULL)
{
if(head1->data != head2->data)
{
head1 = head1->next;
head2 = head2->next;
}
else if(head1->data==head2->data)
{
return head1->data;
}
}
return -1;
}