variable length dynamic vector

I have 24 vectors of maximum 100.000 elements. Now I'm using
xArray = (double*)malloc((number_of_samples)*sizeof(double));
to allocate the memory.

I am doing a signal acquisition from a DAQ board. The vectors dimension depends on how much information I need, so it could be much less than 100.000. How can I allocate dynamic the vector element by element.

realloc() is out the question.
Those are arrays, not vectors.
Use std::vector, then.
http://www.cplusplus.com/reference/stl/vector/
Topic archived. No new replies allowed.