Initializacia
This commit is contained in:
parent
6c79f0d250
commit
91662d4ed8
@ -48,7 +48,7 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
}
|
}
|
||||||
struct car* current = first, new_first = first;
|
struct car* current = first, new_first = first;
|
||||||
if (first != NULL){
|
if (first != NULL){
|
||||||
if(strcmp(first->destination, target) == 0){
|
if(strcmp(first->value, target) == 0){
|
||||||
new_first = new_first->next;
|
new_first = new_first->next;
|
||||||
free(first);
|
free(first);
|
||||||
first = new_first;
|
first = new_first;
|
||||||
@ -57,7 +57,7 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
|
|
||||||
while (first->next != NULL) {
|
while (first->next != NULL) {
|
||||||
current = first->next;
|
current = first->next;
|
||||||
if (strcmp(current->destination, target) == 0) {
|
if (strcmp(current->value, target) == 0) {
|
||||||
first->next = current->next;
|
first->next = current->next;
|
||||||
free(current);
|
free(current);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user