So I am having an issue with not being able to make a new array with a variable size (the variable is declared as const int)
Here is the code
#include <iostream>
#include <string>
int newArraySize;
int main ()
{
std::cin >> newArraySize;
int const fin = newArraySize;
int deduped[fin]; // Here is the error
}
The error I'm getting is
Error: Expression must have a constant value
I tried casting as a constant but still no luck (same error)
int const fin = const_cast<int const&>(newArraySize);
int deduped[fin];
newArraySize, notfin.newArraySizeisn't const.for (int n = 0; n=20; n++)a couple of times. And a nasty one,if (10 > temp > 110). But anyway, doesdedupedever outgrowduper? If not, why don't you just make them the same size?