Please help me correctly declare a dynamic array. How to make, that if, for example, StartPoint occupies more than 15 characters, 3-4 more characters are added to it? I have a total array size of 50. How can I add 15 more lines when overflowed?
typedef struct { char StartPoint[15]; char StartTime[20]; char EndPoint[15]; char EndTime[20]; char Type[14]; } rover; int p = 0, razm = 50; rover *dat = (rover*)malloc(sizeof(rover)*razm);
realloc(), it seems, but I don’t make much sense in C) and through the function wrappers. If such a need arises often, it may be easier to implement a list where you do not need to re-allocate memory. - etki