uprava podmienky
This commit is contained in:
parent
a66b22631d
commit
0510e66518
@ -51,6 +51,13 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
if(this->next->next == NULL){
|
||||
if(strcmp(this->value, target) == 0){
|
||||
free(this);
|
||||
this->next=NULL;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
while( this->next->next != NULL){
|
||||
if(strcmp(this->value, target) == 0){
|
||||
free(this->next);
|
||||
@ -61,12 +68,5 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
this = this->next;
|
||||
}
|
||||
}
|
||||
if(strcmp(this->value, target) ==0){
|
||||
free(this);
|
||||
this->next = NULL;
|
||||
return this;
|
||||
}
|
||||
else{
|
||||
return first;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user