clear train
This commit is contained in:
parent
a4e02b775f
commit
e1a3d77eac
@ -43,6 +43,14 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
if (this == NULL){
|
if (this == NULL){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (this->next == NULL){
|
||||||
|
if(strcmp(this->value, target) == 0){
|
||||||
|
free(this);
|
||||||
|
return NULL;
|
||||||
|
}else {
|
||||||
|
return first;
|
||||||
|
}
|
||||||
|
}
|
||||||
while( this->next->next != NULL){
|
while( this->next->next != NULL){
|
||||||
if(strcmp(this->value, target) == 0){
|
if(strcmp(this->value, target) == 0){
|
||||||
this->next == this->next->next;
|
this->next == this->next->next;
|
||||||
|
Loading…
Reference in New Issue
Block a user