This commit is contained in:
Maryna Kravtsova 2020-11-02 14:37:47 +01:00
parent 966e7ab243
commit 7d285ca052

View File

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