title: Failing While loop when working with Linked lists
body: <p>As part of an assignment, I am having a program read in the names and id of people from a file, and saving them in separate linked lists. I have a nested while loop to traverse the list until it reaches the end, and then assign the values at the end. Unfortunately the program keeps crashing while reading and it seems to revolve around the second while loop.</p>
  
  <p>Here is the struct established before the main()</p>
  
  <pre><code>struct node
  {
      char name[50];
      int id;
      struct node *next;
  }*start;
  </code></pre>
  
  <p>Here is the function itself:</p>
  
  <pre><code>void read()
  {
     int tempNum = 0, id, jack = 0;
     char name[50];
  
     struct node *temp, *right;
     temp = start;
  
     FILE *ifp = fopen("AssignmentOneInput.txt", "r");
     while(fscanf(ifp," %s", &amp;name) != EOF)
     {
  
         fscanf(ifp, " %[^,]s, %[^/n]d", &amp;name, &amp;id);
  
         temp = (struct node *)malloc(sizeof(struct node));
  
         strcpy(temp-&gt;name,name);
         temp-&gt;id = id;
  
         right = (struct node *)start;
  
         printf("test number one\n");
         while(right-&gt;next != NULL)
         {
              printf("test number two\n");
              right = right-&gt;next;
         }
          printf("test number three\n");
  
  
         right-&gt;next = temp;
         right = temp;
  
         right-&gt;next = NULL;
  
     }
  
  }
  </code></pre>
  
  <p>As for its implementation in the main function, it is the very first function called, so it looks a little like:</p>
  
  <pre><code>main()
  {
    read();
  </code></pre>