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) {
struct car* this;
void cancel_train(struct car* first, int val) {
if(first == NULL){
exit(0);
}
else{
else if(first->next == NULL){
struct car* this;
this = first;
first = this->next;
free(this);
}
cancel_train(first->next);
free(first);
}
}

View File

@ -40,7 +40,7 @@ void print_train(struct car* first);
* Zrusenie vsetkych voznov vo vlaku.
* @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