sq插入函数位置不对
This commit is contained in:
Jdhggg 2025-03-17 16:29:06 +08:00
parent 60b1d8e65a
commit 2d99fe1c7e
5 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,3 @@
 main.c
C:\code\lencode\Project2\main.c(9,34): warning C4047: “函数”:“sq_list *”与“sq_list **”的间接级别不同
C:\code\lencode\Project2\main.c(9,34): warning C4024: “init_sq_list”: 形参和实参 1 的类型不同
 sq_list.c
C:\code\lencode\Project2\sq_list.c(10,1): warning C4716: “init_sq_list”: 必须返回一个值
Project2.vcxproj -> C:\code\lencode\Project2\Debug\Project2.exe

View File

@ -54,9 +54,9 @@ void insert_sq_list(sq_list* list, int pos, int value)
printf("有损插入\n");
if (pos > list->length && pos <= MAX)
printf("不建议在此处插入");
int i = list->length;
int i = list->length -1;
int flog = i;
for (i; i > pos; i--)
for (i; i >= pos-1; i--)
{
list->data[i + 1] = list->data[i];
}