Skip to content
Snippets Groups Projects
Commit da6ab4ec authored by ZakyHermawan's avatar ZakyHermawan
Browse files

Fix queue

parent 222e17dd
No related merge requests found
...@@ -37,7 +37,14 @@ Queue* delete(Queue* q) { ...@@ -37,7 +37,14 @@ Queue* delete(Queue* q) {
} }
Node* ptr = q->front; Node* ptr = q->front;
if(q->front == q->rear) {
free(q->front);
q->front=q->rear=NULL;
return q;
}
q->front = q->front->next; q->front = q->front->next;
free(ptr); free(ptr);
return q; return q;
} }
......
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