0
Guys, I have a problem with this issue:
-I have to compare two chained lists and return 1 if they are equal or 0 if they are not.
The function is like this and I can’t progress:
  struct Node
  {
 int data;
 struct Node *next;
 }
 int CompareLists(Node *headA, Node* headB) 
 { 
  /*se as duas forem vazias*/
   if(headA->next==NULL && headB->next==NULL) 
  { 
   return 1; 
   } 
   if(headA->next==NULL || headB->next==NULL) 
   { 
   return 0; 
   }  
   while(headA->next!=NULL && headB->next!=NULL) 
   { 
   if(headA->data=!headB->data) 
   { 
   return 0; 
   }else{ 
   return 1; 
   } 
   headA=headA->next; 
   headB=headB->next; 
   } 
   }
I think the problem is going through the list (headA=headA->next), but I don’t know how to do it. Someone can help me?
Equally, you define the same content in the same order?
– Jefferson Quesado
Do not update the question code with answer code, as this invalidates any answers given so far, and is not the way Stackoverflow works.
– Isac
@Isac already got a lot of thanks. Sorry for the inconvenience.
– Maurício Z.B