From 8fb4fea3ecc8fb478f67171248dbce3abd2a42ea Mon Sep 17 00:00:00 2001 From: Ivan Leichenko Date: Thu, 17 Oct 2024 22:42:42 +0200 Subject: [PATCH] update cv4 --- cv4/a_train.c | 3 ++- cv4/main.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cv4/a_train.c b/cv4/a_train.c index 7041f71..6c2afae 100644 --- a/cv4/a_train.c +++ b/cv4/a_train.c @@ -64,9 +64,10 @@ struct car* clear_train(struct car* first, const char* target) } if(first->next == NULL) { - if(strcmp(first->value, target)) + if(!strcmp(target, first->value)) { free(first); + //first = NULL; return NULL; } else diff --git a/cv4/main.c b/cv4/main.c index d054eb1..ee71136 100644 --- a/cv4/main.c +++ b/cv4/main.c @@ -22,7 +22,7 @@ int main() printf("Zadajte stanicu, ktorá sa má vyradiť:\n"); scanf("%s", buf); - clear_train(train,buf); + train = clear_train(train,buf); print_train(train);