This commit is contained in:
Radovan Kofira 2020-11-05 21:45:02 +01:00
parent f4382afafd
commit 4fde774336

View File

@ -36,9 +36,14 @@ void print_train(struct car* first) {
void cancel_train(struct car* first) {
if(first!=NULL){
first=first->next;
free(first->next);
cancel_train(first);
struct car* temp= first;
struct car* next;
while(temp!=NULL){
next=temp->next;
free(temp);
temp=next;
}
first=NULL;
}
}