This commit is contained in:
Maryna Kravtsova 2020-10-27 18:43:29 +01:00
parent 20fc5fc559
commit a3c825715d
2 changed files with 7 additions and 7 deletions

View File

@ -31,19 +31,19 @@ void print_train(struct car* first) {
} }
} }
void cancel_train(struct car* first) { void cancel_train(struct car* first, int val) {
struct car* this;
if(first == NULL){ if(first == NULL){
exit(0); exit(0);
} }
else{ else if(first->next == NULL){
struct car* this;
this = first; this = first;
first = this->next; first = this->next;
free(this); free(this);
}
cancel_train(first->next); cancel_train(first->next);
free(first); free(first);
}
} }

View File

@ -40,7 +40,7 @@ void print_train(struct car* first);
* Zrusenie vsetkych voznov vo vlaku. * Zrusenie vsetkych voznov vo vlaku.
* @arg smernik na prvy vozen * @arg smernik na prvy vozen
*/ */
void cancel_train(struct car* first); void cancel_train(struct car* first, int val);
/** /**
* Vyradenie vsetkych voznov, ktorych cielova stanica je target * Vyradenie vsetkych voznov, ktorych cielova stanica je target