clear
This commit is contained in:
parent
1556d1882c
commit
a6861c0d99
@ -65,8 +65,11 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
if(first == NULL){
|
if(first == NULL){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
if(first->next == NULL){
|
if(first->next == NULL){
|
||||||
if(first->value == target){
|
x = strcmp(first->value, target);
|
||||||
|
if(x == 0){
|
||||||
free(first);
|
free(first);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -74,7 +77,9 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
else{
|
else{
|
||||||
struct car* this = first;
|
struct car* this = first;
|
||||||
while(this != NULL){
|
while(this != NULL){
|
||||||
if(this->value == target){
|
int x == strcmp(this->value, target);
|
||||||
|
if(x == 0){
|
||||||
|
free(this->value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
this = this->next;
|
this = this->next;
|
||||||
|
Loading…
Reference in New Issue
Block a user