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);