This commit is contained in:
Valér Jakubčo 2021-11-05 08:21:26 +01:00
parent 6a9d07cee3
commit 1cc637bbf4

View File

@ -53,11 +53,8 @@ struct car* clear_train(struct car* first, const char* target) {
}
if(this->next->next == NULL){
if(strcmp(this->value, target) == 0){
//strcpy(this->value,this->next->value);
//this->next=NULL;
struct car* tmp = this->next;
free(this);
//free(this->next);
return tmp;
}else if(strcmp(this->next->value, target) == 0){
free(this->next);
@ -80,6 +77,10 @@ struct car* clear_train(struct car* first, const char* target) {
free(this->next);
this->next=NULL;
return this;
}else if(strcmp(this->next->next->value, target) == 0){
free(this->next->next);
this->next=NULL;
return this;
}
return first;
}