Dumb question. but can you do this.
(these are global variables by the way)
int size;
double Values[size];
If Im getting the SIZE from a file?
I know you probably can’t, but maybe theirs some way to readjust the size based on the number I read in from the file (like say I read in 7, I know Values will have to be of Size 7).
The compiler complains, but Im wondering if their is some workaround. (these have to stay as global variables btw.
No, you can only specify array sizes like this using constant integral expressions. Meaning known at compile-time.
You probably shouldn’t be doing this, anyway. Instead, you should be using a vector.
If for whatever reason you can’t use a vector (which I would seriously doubt), then your next option would be to use dynamically-allocated arrays. But please, for the love of all that is good int he world, use a smart pointer if you do this.