Commit 996cb357 authored by Shivaji's avatar Shivaji

change in remove_queue method

parent 0691e504
......@@ -25,15 +25,22 @@ void remove_element_from_deque(char *key)
queue *present = qu , *previous=NULL;
if(present == NULL)
return;
if(strcmp(present->key, key) == 0)
{
qu = qu->next;
if(last == present)
last = last->next;
free(present);
return;
}
while(present->next != NULL)
{
if(present->key == key)
if(strcmp(present->key, key) == 0)
{
if(previous == NULL)
qu = qu->next;
if(last == present)
last = previous;
if(previous)
previous->next = present->next;
free(present);
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment