title: Storing more than one data item in single linked list
body: <p>I am trying to store more than one data item in single linked list. I had tried with 2 data item , program complies with no error as, inserting data also work fine but program stop while printing output. I can't figure out whats wrong with code.
  Any help will be greatly appreciated. </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  
  struct node{
      float a;
      float b;
      struct node *next;
  };
  
  struct node *head;
  
  void insert(float x,float y){
      struct node *temp;
      temp = (struct node*)malloc(sizeof(struct node));
      temp-&gt;a = x;
      temp-&gt;b = y;
      temp-&gt;next = head;
      head= temp;
  }
  void print(){
      struct node *temp;
      temp= head;
      printf("\n the linked list is :");
      while(head!=NULL){
          printf("data is : %f %f",temp-&gt;a,temp-&gt;b);
          temp=temp-&gt;next;
      }
  }
  
  int main()
  {
      int n,i,x,y;
      head = NULL;
      struct node *temp;
      printf("\n enter the  number of data to enter:");
      scanf("%d",&amp;n);
      for(i=0;i&lt;n;i++){
          printf("\n enter x-cordinate: \n");
          scanf("%f",&amp;x);
          printf("\n eter y-cordinate: \n");
          scanf("%f",&amp;y);
          insert(x,y);
      }
      print();
      return 0;
  }
  </code></pre>