From d5ec73c414c2af994fcac44a6c03b66b3f51c21c Mon Sep 17 00:00:00 2001 From: Anton Dolozin Date: Wed, 5 Nov 2025 15:04:07 +0100 Subject: [PATCH] Added search function --- du5/a_station.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } +