I'd suggest reading in a single pass instead. Do this by reading line by line into a sufficiently long string. Check if the line begins with a '#', and if so, you can skip it. Otherwise, parse it for the numeric values.
For saving the numeric values, you can start with a dynamic array of a small capacity (number of elements allocated) with zero size (number of elements in use). As you read the numeric values into struct objects and populate the dynamic array with these struct objects, the size will eventually reach the capacity. At that point, to add more numeric value struct objects, you expand the capacity of the dynamic array by a factor (typically 1.5 or twice). So, by keeping track of both size and capacity, you can read in a single pass rather than having a first pass to find the size and then a second pass to do the actual reading and extraction.