Aktualizovat du6/a_station.c

This commit is contained in:
Tomáš Vlček 2026-04-22 21:14:01 +00:00
parent 6a70a3d15a
commit 47c7b9a9dd

View File

@ -9,7 +9,25 @@ struct station* create_station(){
return station;
}
void destroy_station(struct station* station){
void destroy_station(struct station* station)
{
if (station == NULL)
{
return;
}
struct car* currentTracks = station->tracks;
for (int i = 0; i < STATION_SIZE, i++)
{
while (currentTracks->next != NULL)
{
struct car* tempTrack = currentTracks;
currentTracks = currentTracks->next;
free(tempTrack);
}
}
}
int select_track(struct station* station, const char* target){