title: C++ create and print deque
body: <p>I'm tring to create a deque and list the elements in it. I've made two functions for this: create_queue and print_queue. I've sent the pointers (head and tail) as reference so I don't have to declare them globally.</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  struct Nod {
      int info;
      Nod* next, *back;
  };
  
  void create_queue(Nod*&amp; p, Nod*&amp; u)
  {
      Nod *c = new Nod;
      cout &lt;&lt; "c-&gt;info: "; cin &gt;&gt; c-&gt;info;
      if (!p)
      {
          p = c;
          p-&gt;back = NULL;
          p-&gt;next = NULL;
          u = p;
      }
      else
      {
          u-&gt;next = c;
          c-&gt;back = u;
          u = c;
          u-&gt;next = NULL;
      }
  }
  
  void print_queue(Nod*&amp; p, Nod*&amp; u)
  {
      Nod *c = p;
      while (c) {
          cout &lt;&lt; c-&gt;info &lt;&lt; " ";
          c = c-&gt;next;
      }
  }
  
  
  int main()
  {
      int n, i = 1;
      Nod *p, *u = new Nod;
      cout &lt;&lt; "Nr nod: "; cin &gt;&gt; n;
      while (i &lt;= n){
      create_queue(p, u);
      i++;
      }
      print_queue(p, u);
      getchar();
  }
  </code></pre>
  
  <p>From what I understand from the debugger, I'm not able to access p->info.
  What is the problem?</p>