Advertisement
Guest User

Untitled

a guest
Feb 28th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1.      T dequeue() //removeBack
  2.      {
  3.          if (head == NULL) //empty
  4.          {
  5.              return NULL;
  6.          }
  7.          else if (head->next == NULL) //only one item
  8.          {
  9.             T output;
  10.             output = head->data;
  11.             head = NULL;
  12.             delete head;
  13.             return output;
  14.          }
  15.          else
  16.          {   T output;
  17.              temp = tail;
  18.              output = tail->data;
  19.              tail = temp->prev;
  20.              tail->next = NULL;
  21.              delete temp; //ERROR OCCURS HERE
  22.              //tail->next = NULL;
  23.              return output;
  24.  
  25.          }
  26.      }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement