diff --git a/du5/a_station.c b/du5/a_station.c index 1ce6936..d17f0ef 100644 --- a/du5/a_station.c +++ b/du5/a_station.c @@ -61,9 +61,12 @@ int get_target_capacity(struct station* station,const char* target){ int res = select_track(station, target); struct car** ptr = &station->tracks[res]; struct car* head = *ptr; - if(head){ + while (head) + {if(strcmp(head->value, target) == 0){ return head->capacity; } + head = head->next; + } return 0; } @@ -101,3 +104,4 @@ int count_capacity(struct station* station){ return total; } +