delete
This commit is contained in:
parent
fdde562ecf
commit
3ec3997cd6
@ -32,27 +32,28 @@ void print_train(struct car* first) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cancel_train(struct car* first) {
|
void cancel_train(struct car* first) {
|
||||||
struct car* this;
|
//struct car* this;
|
||||||
if(first == NULL){
|
if(first == NULL){
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
else if(first->next == NULL){
|
if(first->next == NULL){
|
||||||
//this = first;
|
//this = first;
|
||||||
//first = first->next;
|
//first = first->next;
|
||||||
free(first);
|
free(first);
|
||||||
first = NULL;
|
//first = NULL;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
struct car* prev = first;
|
/*struct car* prev = first;
|
||||||
while(prev->next->next != NULL){
|
while(prev->next->next != NULL){
|
||||||
prev = prev->next;
|
prev = prev->next;
|
||||||
}
|
}
|
||||||
this = prev->next;
|
this = prev->next;
|
||||||
prev->next = NULL;
|
prev->next = NULL;
|
||||||
free(this);
|
free(this);*/
|
||||||
|
|
||||||
|
cancel_train(first->next);
|
||||||
|
free(first);
|
||||||
}
|
}
|
||||||
//cancel_train(first->next);
|
|
||||||
//free(first);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user