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 fr
dynamic allocation. The new keyword will do this with a pointer and some allocation.
new
int * ptr; int n = a.size(); ptr = new int[n];