title: How to get the common elements of the two sets in a Linked List?
body: <p>I have got 2 linkedlist, I want to compare both lists and print every common element that appears in both list. tried everything can't get it to work.</p>
  
  <pre><code>struct Node *calcIntersection(struct Node *headA, struct Node *headB)
  {
  
   struct Node * link1 = headA;
  
   struct Node * link2 = headB;
  
   while(link1 != NULL)
   {
  
    if (link2-&gt;value == link2-&gt;value)
       {
  
        printf("%d", link1-&gt;value);
  
       }      
  
      link1 = link1 -&gt; pNext;
  
   }
  
    return link1;
  
  }
  </code></pre>