title: Function to read the data file as nodes in a linked list
body: <p><code>My text file reads as this:
  George Washington, 2345678
  John Adams, 3456789
  Thomas Jefferson, 4567890
  James Madison, 0987654
  James Monroe, 9876543
  John Quincy Adams, 8765432
  Andrew Jackson, 7654321
  Martin Van Buren, 6543210</code></p>
  
  <p>However, when I run my current code to display I don't get those numbers and end up with random ones, how can I fix this? You can avoid the other functions for now as I am just trying to make sure the file reads into different nodes.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  //Creates node for holding student's information
  struct node
  {
  char name [50];
  int id;
  struct node *next;
  }*head;
  
  //Create Function Prototypes
  void readDataFile ();
  void display(struct node *d);
  void deleteID(int num);
  void deleteName(char dname);
  
  
  //Main function
  int main()
  {
  //Declare variables
  int i, num, intid;
  char *name;
  char nameDelete [50];
  char nameInsert [50];
  struct node *n;
  
  //initialize link list
  head = NULL;
  
  //Read in file
  readDataFile();
  
  //Create list of operations utilized in program
  while (1)
  {
      printf("\nList Operations\n");
      printf("===============\n");
      printf("1.Insert\n");
      printf("2.Display\n");
      printf("3.Delete by ID\n");
      printf("4.Delete by Name\n");
      printf("5.Exit\n");
      printf("Enter your choice : ");
  
      if(scanf("%d", &amp;i) &lt;= 0)
      {
          printf("Enter only an Integer\n");
          exit(0);
      }
      else
      {
          switch(i)
          {
              case 1:
                  printf("Enter the name to insert: ");
                  gets(nameInsert);
                  printf("Enter the ID associated with the name: ");
                  scanf("%d", &amp;intid);
                  break;
              case 2:
                  if (head == NULL)
                      printf("List is Empty\n");
                  else
                  {
                      printf("Elements in the list are:\n");
                  }
                  display(n);
                  break;
              case 3:
                  if(head == NULL)
                      printf("List is Empty\n");
                  else
                  {
                      printf("Enter the ID number to delete: ");
                      scanf("%d", &amp;intid);
                  }
                  break;
              case 4:
                  if(head == NULL)
                      printf("List is Empty\n");
                  else
                  {
                      printf("Enter name to delete: ");
                      gets(nameDelete);
                  }
              case 5:
                  return 0;
              default:
                  printf("Invalid option\n");
          }
      }
  }
  return 0;
  }
  </code></pre>