I am very confused about the way arrays are initialized under g++. (I am using Red Hat Linux 9)
int size; cin >> size; int myarray[size];
According to what I had known earlier this should not be possible since the size of the array should be a constant.
But this seems to work perfectly under g++. To my knowledge in Standard C++ you are not allowed to use a variable during a array declaration.
If you can create dynamic arrays this way, why bother using dynamic arrays using pointers ?
e.g.
int size; cin >> size; int * pmyarray = new int[size];
Nuwan