title: Moving data from linked list to queue [c]
body: <p>So I am a self learner and I am stuck here. What I want to accomplish is create a linked list with some data, then pick a random node from the linked list, change some data and then move it to a queue(the queue is implemented using linked list as well)</p>
  
  <p>I am not sure how to write my structs too. Here are my structs.</p>
  
  <pre><code>struct Apps{
      int id;
      int size;
      char name;
      float xronos_eiswdou;
      char condition;
      int xronos_ekteleshs;
      struct Apps *next, *next1;
  }*rear, *front;
  </code></pre>
  
  <p>I am sure it is wrong and I don't have a clue on how to fix it.</p>
  
  <p>This is my function as of now.</p>
  
  <pre><code>void push(struct Apps *head)
  {
       struct Apps *temp; 
       struct Apps *temp1;
       temp1=(struct Apps *)malloc(sizeof(struct Apps));
       temp1-&gt;id = temp-&gt;id;
       temp1-&gt;size = temp-&gt;size;
       temp1-&gt;name = temp-&gt;name;
       temp1-&gt;xronos_eiswdou = temp-&gt;xronos_eiswdou;
       temp1-&gt;condition = temp-&gt;condition;
       temp1-&gt;xronos_ekteleshs = temp-&gt;xronos_ekteleshs;
       temp1-&gt;next = head;
       if (front == NULL)
       {
             front=temp1;
             front-&gt;next1=NULL;
             rear=front;
       }
       else
       {
             front-&gt;next1=temp1;
             front=temp1;
             front-&gt;next1=NULL;
       }
  }
  </code></pre>
  
  <p>Here is my main code for adding data to my linked list:</p>
  
  <pre><code>for(step = 0; step &lt; 100; step++)
        {
          int r = rand() % 100+1;
          if(r &lt; 31){
              int r1 = rand() % 100+1;
              aa = r1;
              int r2 = rand() % 100+1;
              bb = r2;
              int r3 = rand() % 3;
              if(r3 == 0){ 
                   cc = 'l';
              }
              else if(r3 == 1 ){ 
                   cc = 'b';
              }
              else if( r3 == 2 ){ 
                   cc = 'c';
              }
              dd = (double)seconds/CLOCKS_PER_SEC;
              ee = 'a';
              ff = -1;
              insert_new(aa, bb, cc, dd, ee, ff);
          }
          else if(r &gt; 30 &amp;&amp; r &lt; 51){
              pickRandom(head); /*picking a random node and changing some data*/
              /*Here I need a function which moves the data of the above node to a queue*/
          }
      }
  </code></pre>
  
  <p>Long story short, I need a function which moves data from a linked list to a queue! Any help is appreciated and excuse my question, I am learning stuff by myself :/</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tried something which seems to work, well kind off...
  Here are my structures:</p>
  
  <pre><code>    struct Apps{
      int id;
      int size;
      char name;
      float xronos_eiswdou;
      char condition;
      int xronos_ekteleshs;
      struct Apps *next;
  };
  
  struct Queue
  {
      int id1;
      int size1;
      char name1;
      float xronos_eiswdou1;
      char condition1;
      int xronos_ekteleshs1;
      struct Queue *next;
      struct Queue *front;
      struct Queue *rear;
  };
  </code></pre>
  
  <p>and here is my function:</p>
  
  <pre><code>struct Queue *start = NULL;
  struct Queue *front = NULL;
  struct Queue *rear = NULL;
  
      void push()
      {
           struct Apps *temp; 
           struct Queue *temp1;
           temp1=(struct Queue *)malloc(sizeof(struct Queue));
           temp1-&gt;id1 = temp-&gt;id; 
           temp1-&gt;size1 = temp-&gt;size;
           temp1-&gt;name1 = temp-&gt;name;
           temp1-&gt;xronos_eiswdou1 = temp-&gt;xronos_eiswdou;
           temp1-&gt;condition1 = temp-&gt;condition;
           temp1-&gt;xronos_ekteleshs1 = temp-&gt;xronos_ekteleshs;
           temp1-&gt;next = start;
           if (front == NULL)
           {
                 front=temp1;
                 front-&gt;next=NULL;
                 rear=front;
           }
           else
           {
                 front-&gt;next=temp1;
                 front=temp1;
                 front-&gt;next=NULL;
           }
  }
  </code></pre>
  
  <p>The program runs with no errors but it crashes, so it's something wrong again!</p>