I am trying to read a big ticks file in C and save them a struct for every second. In each second, I will have different tickers in this struct. However, my code will get crash if in some second we saw too much high volume of tickers. 

For example,

In second 1, it only have 10 tickers.
In second 1000, it is seeing 10000. 

My code will allocate the same size of memory for each second so it waste too many memory for quiet second but not big enough for busy second. 

Please find my add struct code below,

```
long int addTickArray(long int TickTime, int maximumOrderSize, struct TickArray*TickArray, long int TickPos) {

        int i;

        for (i = TickPos; i < maximumOrderSize; i++) {

            if (TickArray[i].TickTime == NULL) {

                break;

            } else if (TickArray[i].TickTime == TickTime) {

                return i;

            }

        }

        struct TickArray newTickArray;

        newTickArray.Ticker = malloc(4000 * sizeof (char*) *10);
        newTickArray.askprice = malloc(4000 * sizeof (float*));
        newTickArray.bidprice = malloc(4000 * sizeof (float*));

        newTickArray.TickTime = TickTime;

        newTickArray.TickTimePos = 0;

        TickArray[i] = newTickArray;

        return(i);
    }

```

I am not sure is there any smart way to allocate a flexible memory for the struct.