void method(string a) {
int n = a.size();
int array[n];
}
The above code can compile correctly using gcc. How can the size of the array come from a non-constant variable? Does the compiler automatically translate the int array[n] to int* array = new int[n]?
const. Use reference. Use vector-pedantic-errors, and then see what it says!-std=c++1yand see what it says.