diff --git a/cv5/a_train.c b/cv5/a_train.c index 8e85900..34e7a84 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -33,20 +33,12 @@ void print_train(struct car* first) { } void cancel_train(struct car* first) { - if(first == NULL){ - return; - } - if(first->next != NULL){ - cancel_train(first->next); - first->next = NULL; - } - else if(first->next == NULL){ - free(first); + if(first != NULL){ + cancel_train(first->next); + free(first); } } - - struct car* clear_train(struct car* first, const char* target) { if(first == NULL){ return 0;