diff --git a/delete.c b/delete.c index 07bf675..d969d58 100644 --- a/delete.c +++ b/delete.c @@ -3,7 +3,7 @@ void cancel(ss*stu){ char* tmp = (char*)malloc(sizeof(char)*3); do{ - char*ID = (char*)malloc(sizeof(char)*5); + char*ID = (char*)malloc(sizeof(char)*6); scanf("%s",ID); for(int i = 0; i < stu->nums; ++i){ if(strcmp(stu->student[i].id,ID) == 0){ @@ -12,6 +12,7 @@ void cancel(ss*stu){ } } } + stu->nums--; allPrint(stu); printf("continue?\n"); scanf("%s",tmp); diff --git a/init.c b/init.c index 80e20eb..704ec37 100644 --- a/init.c +++ b/init.c @@ -1,4 +1,4 @@ -#include "mysyslib.h" +w#include "mysyslib.h" ss* init(int Nums){ ss* stu = (ss*)malloc(sizeof(ss)); @@ -9,8 +9,8 @@ if(!stu->student) return NULL; for(int i = 0; i < Nums; ++i){ - stu->student[i].id = (char*)malloc(sizeof(char)*5); - stu->student[i].class = (char*)malloc(sizeof(char)*2); + stu->student[i].id = (char*)malloc(sizeof(char)*6); + stu->student[i].class = (char*)malloc(sizeof(char)*3); stu->student[i].name = (char*)malloc(sizeof(char)*10); }