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) { void cancel_train(struct car* first) {
if(first!=NULL){ if(first!=NULL){
first=first->next; struct car* temp= first;
free(first->next); struct car* next;
cancel_train(first); while(temp!=NULL){
next=temp->next;
free(temp);
temp=next;
}
first=NULL;
} }
} }