I can't seem to get an array of strings declared inside a function.
void foo(string arr[], int arrSize) {
string temp[arrSize];
int temp2[arrSize];
}
I get a compile-time error: a variable-length array of a non-POD element of type 'string' (aka 'basic_string, allocator>') ... [a ...
I tried to declare the arrSize parameter as a constant with void foo(string arr[], const int arrSize);and even declare a new constant integer inside the function and initialize it with arrSize, but both still produce the same error. The only way I was able to compile this was to use a magic number when declaring my array of temp strings.
Also, I know that I could just use a vector instead, but I'm just wondering why this is happening.
Thanks in advance for your help!