Added search function

This commit is contained in:
Anton Dolozin 2025-11-05 15:04:07 +01:00
parent e6d12c5c1c
commit d5ec73c414

View File

@ -61,9 +61,12 @@ int get_target_capacity(struct station* station,const char* target){
int res = select_track(station, target); int res = select_track(station, target);
struct car** ptr = &station->tracks[res]; struct car** ptr = &station->tracks[res];
struct car* head = *ptr; struct car* head = *ptr;
if(head){ while (head)
{if(strcmp(head->value, target) == 0){
return head->capacity; return head->capacity;
} }
head = head->next;
}
return 0; return 0;
} }
@ -101,3 +104,4 @@ int count_capacity(struct station* station){
return total; return total;
} }