title: How to print a simple linked list (C++)?
body: <p>The code that I have made is this:</p>
  
  <pre><code>struct node
  {
      int value;
      node *prev;
      node *next;
  };
  
  void play()
  {
      node *head = NULL, *temp = NULL, *run = NULL;
  
      for (int x = 1; x &gt; 10; x++)
      {
          temp = new node();    //Make a new node
          temp -&gt; value = x;    //Assign value of new node
          temp -&gt; prev = NULL;  //Previous node (node before current node)
          temp -&gt; next = NULL;  //Next node (node after current node)
      }
      if (head == NULL) 
      {
          head = temp; //Head -&gt; Temp
      }
      else
      {
          run = head; //Run -&gt; Head
          while (run -&gt; next != NULL)
          {
              run = run -&gt; next; //Go from node to node
          }
          run -&gt; next = temp; //If next node is null, next node makes a new temp
          temp -&gt; prev = run;
      }
      run = head; //Play from start again
      while (run != NULL)  //Printing
      {
          printf("%d\n", run -&gt; value);
          run = run -&gt; next;
      }
  }
  
  
  int main()
  {
    play();
    system ("pause");
    return 0;
  }
  </code></pre>
  
  <p>However, it is not working. There is no output (completely blank). How can I get this linked list to print properly? I want it to output:</p>
  
  <pre><code>1 2 3 4 5 6 7 8 9 10
  </code></pre>
  
  <p>Other options that I have is to make another separate function for the printing or move the whole thing to int main but I have already tried that and it still does not output anything.</p>