This commit is contained in:
Maryna Kravtsova 2020-10-27 17:37:53 +01:00
parent 7be122a19c
commit 96151e5e3b

View File

@ -16,7 +16,6 @@ struct car* add_car(struct car* first,const char* target) {
}
this->next = newcar;
return first;
}
void print_train(struct car* first) {
@ -32,18 +31,15 @@ void print_train(struct car* first) {
}
}
void cancel_train(struct car* first) {
struct car *this = first->next;
if(first == NULL){
exit(0);
}
if(first->next == NULL){
struct car *this = first;
first = first->next;
free(this);
exit(0);
if(first->value == NULL){
free(first);
}
cancel_train(first->next);
cancel_train(this->next);
free(first);
}