From e69f60c07cff9963aa8fd19ae93df4fdd71fd074 Mon Sep 17 00:00:00 2001 From: gonglja <39959756+Gonglja@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:09:45 +0800 Subject: [PATCH] fix(linkedlist_queue.c): Remove redundant conditional judgments. (#1055) --- codes/c/chapter_stack_and_queue/linkedlist_queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codes/c/chapter_stack_and_queue/linkedlist_queue.c b/codes/c/chapter_stack_and_queue/linkedlist_queue.c index 9ffdf3b49..60437c2cf 100644 --- a/codes/c/chapter_stack_and_queue/linkedlist_queue.c +++ b/codes/c/chapter_stack_and_queue/linkedlist_queue.c @@ -24,7 +24,7 @@ LinkedListQueue *newLinkedListQueue() { /* 析构函数 */ void delLinkedListQueue(LinkedListQueue *queue) { // 释放所有节点 - for (int i = 0; i < queue->queSize && queue->front != NULL; i++) { + while (queue->front != NULL) { ListNode *tmp = queue->front; queue->front = queue->front->next; free(tmp);