Here is the pseudo code:
1. go through a very large sorted timeseries datafile to determine number of records N
2. dynamically allocate a matrix M of size N * 3 to hold all data
3. do statistical analysis
4. release memory
step 1 and 2 needs about 227 lines, and I would like to wrap them up as a function, i.e., ??? readdata(???, ???, ???)
and caller should get the point to the matrix M, and be able to release memory used by M.
I am not sure how to design the prototype of M. Or is there a better design. Thanks.