This commit is contained in:
Maryna Kravtsova 2020-11-02 14:46:04 +01:00
parent 7d285ca052
commit df034f6c6d

View File

@ -40,14 +40,14 @@ void print_train(struct car* first) {
void cancel_train(struct car* first) { void cancel_train(struct car* first) {
if(first == NULL){ if(first == NULL){
exit(0); return;
} }
if(first->next != NULL){ else if(first->next != NULL){
cancel_train(first->next); cancel_train(first->next);
first->next = NULL; first->next = NULL;
//free(first); free(first);
} }
if(first->next == NULL){ else if(first->next == NULL){
free(first); free(first);
} }