From 54e3f319a856564fbca6afaf3b345f644093fe24 Mon Sep 17 00:00:00 2001 From: Weber Date: Fri, 22 Mar 2024 00:26:40 +0000 Subject: [PATCH] skuska --- cv5/program.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cv5/program.c b/cv5/program.c index fd55e66..888c5f6 100644 --- a/cv5/program.c +++ b/cv5/program.c @@ -27,19 +27,11 @@ int main() { char line[1024]; - while (fgets(line, sizeof(line), stdin) != NULL) { int vote_count; char name[1024]; sscanf(line, "%d %[^\n]", &vote_count, name); - char *prev_name = NULL; - int total_vote_count = 0; - - if (student_count > 0 && strcmp(students[student_count - 1].name, name) == 0) { - vote_count += students[student_count - 1].vote_count; - } - if (student_count >= students_capacity) { students_capacity = (students_capacity + 1) * 2; student_t *new_students = realloc(students, students_capacity * sizeof(student_t)); @@ -64,7 +56,7 @@ int main() { } for (int i = 0; i < student_count; i++) { - free(student_t.name); + free(students[i].name); } free(students);