Click to See Complete Forum and Search --> : Array


May 8th, 1999, 12:41 PM
How can I assign a size to an array. For example. I want to read from a data file and count records, lines, or watever. Then I want to declare an array using that count.

double Test[Counter]; // Counter being defined as: int Counter = 0;

Then once I read the file and the counter now equals 113 how can I declare the above array? The compiler says I need a const value. How can I get around this? Is there a way I can typecast the int Counter? Thanks for your help.

May 8th, 1999, 01:12 PM
double * test = new double[count];

Orion Mazzor
May 8th, 1999, 01:59 PM
Just don't forget to:

delete [] test;