title: How to find duplicates in a linked list?
body: <pre><code>void duplicates()
  {
      int count=0;
      struct node *temp=(struct node*)malloc(sizeof(struct node));
      temp=head;
      struct node *temp1=(struct node*)malloc(sizeof(struct node));
      temp1=head;
  while(temp!=NULL)
  {
      while(temp1!=NULL)
      {
          if(strcmp(temp-&gt;FN,temp1-&gt;FN)==0)
          {
  
              count++;
          }
          temp1=temp1-&gt;next;
      }
      if(count&gt;1)
      {
          printf("DUPLICATE FOUND: %s",temp-&gt;FN);
      }
      count=0;
      temp=temp-&gt;next;
  }
  }
  </code></pre>
  
  <p>I'm trying to find duplicates from a linked list and can't find it with my function, I have checked to see that the linked list has all the data stored with a print() function so I think the problem lies in my logic to find the duplicates. 
  Thank You</p>