title: Linked list shows only first node element on printing
body: <p>I am trying to create a linked list in order to enhance my concepts of pointers and address. I have to create linked list in following way:</p>
  
  <p>(1) Read all the nodes together at once at terminal.</p>
  
  <p>(2) Then show the final linked list so formed at last. </p>
  
  <p>How i try to do so ?
  I am reading first the size of linked list (total number of nodes to be entered). Then i read all the nodes 1 by one in <code>do-while</code> loop. After reading all the nodes i try to create linked list. I differentiate the case when the node is first node to be created by a <code>count</code> variable which will have <code>count=0</code> when the node is first node after that it will be in another loop.</p>
  
  <p>The output i get is as follows:</p>
  
  <pre><code> enter the size of node
  4
  start entering the number of elements until your size
  2
  3
  4
  5
  Printing linked list
  2-&gt; //It don't print the other nodes, Just first one
  hp@ubuntu:~/Desktop/pointer$ 
  </code></pre>
  
  <p>My full code to do so is :</p>
  
  <pre><code>#include &lt;stdio.h&gt; 
  #include &lt;stdlib.h&gt; 
  #include &lt;malloc.h&gt; 
  #include &lt;string.h&gt;
  
  struct node 
  {
      int freq;
      struct node * next;
  };
  typedef struct node node;
  node * tree;
  
  void main() 
  {
      int size, data;
      int count = 0; //this count flag is to check is it's first node or not inside the do-while loop.
      tree = NULL;
      printf("enter the size of node\n");
      scanf("%d", &amp; size);
      printf("start entering the number of elements until your size\n");
      node * temp3 = tree;
      node * prev;
      //Problem creating area is below
      do
      {
          scanf("%d", &amp; data);
          if (count == 0)
          {
              node * temp;
              temp = (node * ) malloc(sizeof(node));
              temp-&gt; freq = data;
              temp-&gt; next = NULL;
              prev = temp;
          } 
          else if (count != 0) 
          {
              node * temp;
              temp = (node * ) malloc(sizeof(node));
              temp-&gt; freq = data;
              temp-&gt; next = NULL;
              prev-&gt; next = temp;
          }
          size--;
          ++count;
      }
      while (size &gt; 0);
  
      printf("Printing linked list\n");
      node * temp1;
      temp1 = prev;
      //there may be problem here
      while (temp1-&gt; next != NULL) 
      {
          printf("%d-&gt; ", temp1-&gt; freq);
          temp1 = temp1-&gt; next;
      }
      printf("\n");
  }
  </code></pre>
  
  <p>Couldanyone please help me in printing the full linked list by pointing me the error with  it's solution ?</p>