diff --git a/Data Structure/Queue Using Linked List.cpp b/Data Structure/Queue Using Linked List.cpp index acf32ebd5..763534f83 100644 --- a/Data Structure/Queue Using Linked List.cpp +++ b/Data Structure/Queue Using Linked List.cpp @@ -35,7 +35,7 @@ void Enque(int x) void Deque() { - if (rear==front) + if (rear == NULL && front == NULL) { cout<<"\nUnderflow"; } @@ -45,6 +45,8 @@ void Deque() cout<<"\n"<val<<" deleted"; front=front->next; delete t; + if(front == NULL) + rear = NULL; } }