Update cv6/a_station.c

This commit is contained in:
Viktor Daniv 2024-11-06 11:16:09 +00:00
parent a8b18d2864
commit b092ab2b21

View File

@ -2,6 +2,18 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
struct car {
char target[50]; // Cíl trati, řetězec
int capacity; // Kapacita trati
};
struct station {
struct car** tracks; // Pole ukazatelů na `car` (jednotlivé tratě)
int track_count; // Počet tratí
};
struct station* create_station() { struct station* create_station() {
struct station* station = (struct station*)calloc(1, sizeof(struct station)); struct station* station = (struct station*)calloc(1, sizeof(struct station));
station->tracks = (struct car**)calloc(STATION_SIZE, sizeof(struct car*)); station->tracks = (struct car**)calloc(STATION_SIZE, sizeof(struct car*));