diff --git a/cv4/a_train.c b/cv4/a_train.c index dd0f56f..0374dfb 100644 --- a/cv4/a_train.c +++ b/cv4/a_train.c @@ -104,6 +104,13 @@ struct car* clear_train(struct car* first, const char* target) while (prev->next->next != NULL) { if(!strcmp(prev->value, target)) + { + struct car* second = prev->next; + free(prev); + first = second; + return first; + } + else if(!strcmp(prev->next->value, target)) { struct car* third = prev->next->next; free(prev->next);