int CompareLists(Node *headA, Node *headB)
{
while((headA != NULL) && (headB != NULL)) {
if(headA->data != headB->data) {
break;
}
headA = headA->next;
headB = headB->next;
}
if((headA == NULL) && (headB == NULL)) {
return 1;
} else {
return 0;
}
}
{
while((headA != NULL) && (headB != NULL)) {
if(headA->data != headB->data) {
break;
}
headA = headA->next;
headB = headB->next;
}
if((headA == NULL) && (headB == NULL)) {
return 1;
} else {
return 0;
}
}
No comments:
Post a Comment