title: Cycle start node of Cycle linked list
body: <p>I'm trying to implement a program for finding a starting node of circular linked list. My code is-</p>
  
  <pre><code>struct node
  {
  char data;
  struct node *link;
  } ;
  
  char FindStartNode(struct node **q)
  {
      struct node *r,*t;
   r = *q; 
   t = *q;
   while(t-&gt;link != NULL)
   {
       r = r-&gt;link;
       t = t-&gt;link-&gt;link;
       if(r == t)
       {
           break;
       }
   }
   if(t == NULL )
       return NULL;
   r = *q;
   while(r != t)
   {
       t = t-&gt;link;
       r = r-&gt;link;
   }
   return t-&gt;data;
  }
  
  
  int main()
  {
  struct node *p;
  p = NULL;
  char num;
  Append(&amp;p,'A');
  Append(&amp;p,'B');
  Append(&amp;p,'C');
  Append(&amp;p,'D');
  Append(&amp;p,'E');
  Append(&amp;p,'C');
  Display(p);
   num = FindStartNode(&amp;p);
  printf("\nStarting node of the cycle linked list is:- %c",num);
  _getch();
  return 0;
  }
  
  
  int Append(struct node **q, char data)
  {
  struct node *r,*t;
  r = (struct node *)malloc(sizeof(struct node));
  r-&gt;data = data;
  r-&gt;link = NULL;
  if(*q == NULL)
      *q = r;
  else
  {
    t = *q;
    while(t-&gt;link != NULL)
    {
        t = t-&gt;link;
    }
    t-&gt;link = r;
      }
  return 0;
  }
  int Display(struct node *q)
  {
  while(q != NULL)
  {
      printf("%c\t",q-&gt;data);
      q = q-&gt;link;
  }
  return 0;
  }
  </code></pre>
  
  <p>ths is my code. I'm not getting any value in return t->data part or I'm unable to find the start node of cycle ink list.Any help?</p>