update cv4

This commit is contained in:
Ivan Leichenko 2024-10-17 22:42:42 +02:00
parent 31878a2ae7
commit 8fb4fea3ec
2 changed files with 3 additions and 2 deletions

View File

@ -64,9 +64,10 @@ struct car* clear_train(struct car* first, const char* target)
} }
if(first->next == NULL) if(first->next == NULL)
{ {
if(strcmp(first->value, target)) if(!strcmp(target, first->value))
{ {
free(first); free(first);
//first = NULL;
return NULL; return NULL;
} }
else else

View File

@ -22,7 +22,7 @@ int main()
printf("Zadajte stanicu, ktorá sa má vyradiť:\n"); printf("Zadajte stanicu, ktorá sa má vyradiť:\n");
scanf("%s", buf); scanf("%s", buf);
clear_train(train,buf); train = clear_train(train,buf);
print_train(train); print_train(train);