Aktualizovat du6/a_station.c
This commit is contained in:
parent
6a70a3d15a
commit
47c7b9a9dd
@ -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){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user