title: Circular Queue DLL not working as expected for push and display
body: <p>I converted my file into a project file and it now doesnt work like before.</p>
  
  <p>I am using Circular Queue DLL to insert,delete, and display the values.</p>
  
  <p>My problem is that if I were to enter the ff number respectively: <strong>5,4,3</strong> I get <strong>3, 2810, 0</strong>. Which is very very wrong. I have been working on this for hours now and I'm thinking turning it to a project file might have caused some of my variables not to be properly declared or something. Also proj file is a requirement.</p>
  
  <p>here are my codes:</p>
  
  <p>Header:</p>
  
  <pre><code>#ifndef CIRCDLL_H
  #define CIRCDLL_H
  
  
  struct node{
      int val;
      struct node *next;
      struct node *prev;    
  };
  
  typedef struct node NODE;
  
  
  int push();
  int display();
  NODE* create_node(int info);
  #endif
  </code></pre>
  
  <p>Main:</p>
  
  <pre><code>#include "circdll.h"
  #include&lt;conio.h&gt;
  #include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  
  
  NODE *new, *ptr, *prev;
  NODE *first = NULL, *last = NULL;
  int number = 0;
  
  void main()
  {
      int lim,choice,value,i;
      clrscr();
  
       /*get number of nodes*/
       printf("Input # of nodes: ");
       scanf("%d",&amp;lim);
  
  
      for(;;)
      {
          printf("\n\nMENU: \n");
          printf("[1]Enqueue\n[2]Dequeue\n[3]Exit\nChoice: ");
          scanf("%s",&amp;choice);
  
          clrscr();
          switch(choice)
          {
              case '1':
                        printf("Input value: \n");
                        for(i = 1; i &lt;= lim; i++)
                        {
                          /*scanf("%d",&amp;value);*/
                          push();
                          /* insert_lnode(value); */
                         }
                        display();
                        break;
              case '2':
                        /*delete();
                        display();*/
                        break;
              case '3':
                        exit(1);
                        break;
              default:
                        printf("Incorrect choice!\n\n\n");
                        break;
          }
      }
  }
  </code></pre>
  
  <p>Create:</p>
  
  <pre><code>#include "circdll.h"
  #include&lt;stdio.h&gt;
  
  
  
  NODE* create_node(int info){
      int number =0;
      NODE *new;
  
      number++;
      new = (NODE *)malloc(sizeof(NODE));
      new-&gt;val = info;
      new-&gt;next = NULL;
      new-&gt;prev = NULL;
      return new;
  }
  </code></pre>
  
  <p>Push:</p>
  
  <pre><code>#include "circdll.h"
  #include&lt;stdio.h&gt;
  
  int push(){
  
      int info;
      NODE *new, *ptr, *prev,*first, *last;
  
      scanf("%d",&amp;info);
      new = create_node(info);
  
      if (first == last &amp;&amp; first == NULL){
          first = last = new;
          first-&gt;next = last-&gt;next = NULL;
          first-&gt;prev = last-&gt;prev = NULL;
      }else{
          last-&gt;next = new;
          new-&gt;prev = last;
          last = new;
          last-&gt;next = first;
          first-&gt;prev = last;
      }
  
      return 1;
  }
  </code></pre>
  
  <p>Display:</p>
  
  <pre><code>#include "circdll.h"
  #include&lt;stdio.h&gt;
  
  int display(){
      int i,number;
      NODE *ptr, *prev;
      NODE *first, *last;
      if (first == last &amp;&amp; first == NULL)
          printf("\nQueue is empty");
      else{
          for (ptr = last, i = 0;i &lt; number;i++,ptr = ptr-&gt;prev){
              printf("\n%d", ptr-&gt;val);
          }
      }
      return 1;
  }
  </code></pre>