0

```
i need a function that checks in two linked lists are equal thi is what i have so far
bool equal(list L1 , list L2 , int (*p_cmp_f)() ){
if( L1==NULL && L2==NULL)
return TRUE;
else if( L1==NULL || L2==NULL)
return FALSE;
else if( (*p_cmp_f)(L1->data,L2->data) == -1)
return FALSE;
else
equal(L1->next,L2->next) ;
return TRUE;
}
so this is basically how i define a node
struct node { generic_ptr datapointer; list next; };
i basically define a list as a pointer to a node
so a node has a datapointer field and a next field which is basically pointing to another node since a list is a pointer to a node
so the first time im passing the two lists and a compare function
here is the compare function =
int compare_int( generic_ptr x , generic_ptr y){
if( *(int*) x < *(int *)y ) return -1 ;
if( *(int*) x > *(int *)y ) return 1 ;
return 0 ;
}
```

*Edited 5 Years Ago by rockerjhr*: n/a