This commit is contained in:
krahets
2024-12-04 23:55:37 +08:00
parent f5dfdf4308
commit 62aa8d299d
14 changed files with 88 additions and 40 deletions

View File

@@ -2224,6 +2224,18 @@ comments: true
queue->queSize--;
return num;
}
/* 返回数组用于打印 */
int *toArray(ArrayQueue *queue, int *queSize) {
*queSize = queue->queSize;
int *res = (int *)calloc(queue->queSize, sizeof(int));
int j = queue->front;
for (int i = 0; i < queue->queSize; i++) {
res[i] = queue->nums[j % queue->queCapacity];
j++;
}
return res;
}
```
=== "Kotlin"