Advertisement
muntasir007

Untitled

Feb 10th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. int popFirst() {
  2.     int toBeReturned=0;
  3.     if (!isEmpty()) {
  4.         toBeReturned = first->val;
  5.         temp = (node_t*) malloc (sizeof (node_t));
  6.         temp = first->NEXT;
  7.         if (first->NEXT == NULL) {
  8.             first = last = NULL;
  9.         }
  10.         else {
  11.             free(first);
  12.             temp->PREV = NULL;
  13.             first = temp;
  14.         }
  15.     }
  16.     return toBeReturned;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement