From 15a851590b3838ca7962beac130e576f8b8c535a Mon Sep 17 00:00:00 2001 From: wangko <321640253@qq.com> Date: Wed, 18 Oct 2023 21:36:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E4=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Test/README.md | 1 + 数据结构/队列/main.c | 5 ++++- 数据结构/队列/queue.c | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 Test/README.md diff --git a/.gitignore b/.gitignore index 7af84b9..cf8b4b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vscode/** *.exe +Test/** !*.md \ No newline at end of file diff --git a/Test/README.md b/Test/README.md new file mode 100644 index 0000000..85cc732 --- /dev/null +++ b/Test/README.md @@ -0,0 +1 @@ +此文件夹用于存放测试文件 \ No newline at end of file diff --git a/数据结构/队列/main.c b/数据结构/队列/main.c index c19bc60..3b60d4c 100644 --- a/数据结构/队列/main.c +++ b/数据结构/队列/main.c @@ -3,7 +3,8 @@ int main(){ - SqQuecu a_quecu; //初始化队列 + SqQuecu a_quecu; + InitQuecu(&a_quecu,10,sizeof(int));//初始化队列 //出队进队测试 int *tmep;//临时存储进对的返回值 for (size_t i = 0; i < 50; i++) @@ -31,5 +32,7 @@ int main(){ } DestroyQueue(&a_quecu); printf("队列已销毁\n"); + InitQuecu(&a_quecu,80,sizeof(char)); + return 0; } \ No newline at end of file diff --git a/数据结构/队列/queue.c b/数据结构/队列/queue.c index 873995b..18b2317 100644 --- a/数据结构/队列/queue.c +++ b/数据结构/队列/queue.c @@ -63,7 +63,7 @@ void *enQueue(SqQuecu *Q){ if(Q->rear==Q->Maxsize-1)Q->rear=-1; Q->rear++; Q->size++; - return Q->container+Q->rear*Q->NodeSize; + return Q->container + Q->rear*Q->NodeSize; } /*