Hi guys, i wanna make a function in which you give as parameters two sets of temperatures and it prints the same elements.I 've made this but it doesn't work...
Code:
void tomh(struct list_node *head1, struct list_node *head2 )
{
int j=0,k=0;
struct list_node *p;
if (head1->temperature>=1000 || head2->temperature>=1000)
k=1;
p=head2;
while(head1->temperature<1000)
{
p=head2;
while(head1->temperature<=p->temperature)
{
if(head1->temperature==p->temperature)
{
printf("the %d same element is: %d\n", j+1, p->temperature);
}
p=p->next;
j++;
}
head1=head1->next;
}
if(j==0) k=1;
if(k==1) printf("No same elements\n");
}
Thnx in advance for your help