This commit is contained in:
Bohdan Kapliuk 2024-11-03 19:58:47 +02:00
parent 2bb996b323
commit 4253b35109

View File

@ -2,7 +2,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define SIZE 37
struct station* create_station(){
struct station* station = (struct station*)calloc(1,sizeof(struct station));
@ -53,8 +53,8 @@ void add_target_capacity(struct station* station, const char* target, int capaci
struct car* new_car = (struct car*)malloc(sizeof(struct car));
new_car->capacity = capacity;
strncpy(new_car->value, target, SIZE - 1);
new_car->value[SIZE - 1] = '\0';
strncpy(new_car->value, target, TARGET_SIZE - 1);
new_car->value[TARGET_SIZE - 1] = '\0';
new_car->next = station->tracks[track];
station->tracks[track] = new_car;
}