title: linked list in c language crashes
body: <pre><code>final* queue(struct node_q* list,struct m_queue* t_list){
      struct final_q* final_list;
      struct final_q* f_temp;
      struct final_q* curr_f;
      struct node_q* head;
      struct node_q* tail;
      struct node_q* temp;
      struct m_queue* m_temp;
      m_temp = t_list;
      int x,y,z;
      string20 w_nput;// word input
      head = list;
      tail = list;
      final_list = NULL;
  
      do{
      do{
      printf("ENQUEUE or DEQUEUE: ");
      scanf(" %s",w_nput);
      }while(strcmp(w_nput,"ENQUEUE")!=0 &amp;&amp; strcmp(w_nput,"DEQUEUE")!=0 &amp;&amp; strcmp(w_nput,"STOP")!=0);
  
  
      if(strcmp(w_nput,"ENQUEUE")==0){
          temp = malloc(sizeof(struct node_q));
          temp-&gt;pnext = NULL;
          printf("ENQUEUE what?: ");
          scanf("%d",&amp;temp-&gt;ndata);
          if(list == NULL){
              list = temp;
              head = list;
              tail = temp;
          }
          else{
              x = search(m_temp,temp-&gt;ndata);
  
              if(x == -1){
  
                  tail-&gt;pnext = temp;
                  tail = temp;
              }
              else{
                  y = search_index(m_temp,head,x);
                  if(y == -1){
                      tail-&gt;pnext = temp;
                      tail = temp;
                  }
                  else{
                  z = countqueue(list);
                  if(y == z-1){
                      tail-&gt;pnext = temp;
                      tail = temp;
                  }
                  else
                  list = insertnth(head,x,temp);
  
  
              }
  
  
              }
  
  
              }
  
          }
      else if(strcmp(w_nput,"DEQUEUE")==0){
          temp = head;
          head = temp-&gt;pnext;
          temp-&gt;pnext=NULL;
          list = head;
          f_temp=malloc(sizeof(struct final_q));
          f_temp-&gt;pnext = NULL;
          f_temp-&gt;ndata = temp-&gt;ndata;
          if(final_list==NULL){
              final_list = f_temp;
              curr_f = f_temp;
          }
          else{
              f_temp = curr_f-&gt;pnext;
              curr_f = f_temp;
  
          }
          free(temp);
          }
  </code></pre>
  
  <p>there's a problem while dequeing it crashes and whenever I debug it it highlights the  "f_temp = curr_f->pnext;" in the else if Dequeue part the dequeue part supposedly copies the data at the head and copy it to the f_temp node thus creating a new list</p>