title: Error while printing the linked list
body: <p>I created the linked list to store employee id and name.</p>
  
  <p>When I tried to print it, it shows only id not an employee name and i also want to exit the program when the user enter -1 and not asking the name its should simply exit the program and display the id and name i am currently using devC++ for compiling my code</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;conio.h&gt;
  #include&lt;stdlib.h&gt;
  struct node
  {
      int id;
      char name[20];
      struct node *next;
  };
  
  struct node *create()
  {
      struct node *p, *r, *n;
      int s, k;
      char name[20];
      s = sizeof(struct node);
      printf("Linked List\n");
      printf("Enter id:");
      scanf("%d", &amp;k);
      printf("Enter name:");
      scanf("%s", name);
      p = r = NULL;
      while(k!=-1)
      {
          n = (struct node *)malloc(s);
          n-&gt;id = k;
          n-&gt;next = NULL;
          if(r == NULL)
              r = n;
          else
              p-&gt;next=n;
          p=n;
          printf("Enter the Id or-1 to stop:");
          scanf("%d", &amp;k);
          printf("Enter the name ");
          scanf("%s", name);
      }
      return(r);      
  }
  
  void display(struct node *r)
  {
       printf("\nId             Name \n");
       while(r != NULL)
       {
           printf("\n %d", r-&gt;id);
           printf("\n %s", r-&gt;name);
           r = r-&gt;next;    
       }
  }
  
  int main()
  {
      struct node *ptr;
      ptr = create();
      display(ptr);
  }
  </code></pre>