This commit is contained in:
krahets
2024-01-24 16:58:21 +08:00
parent 43afdd3137
commit 9bc021e98c
7 changed files with 43 additions and 39 deletions

View File

@ -1056,7 +1056,7 @@ Below is the code for implementing a queue using a linked list:
/* 析构函数 */
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);