initializing array

I'm using the following statements to initialise array
int d;
cin >> d;
int array[d];

and these are working properly!
isn't this incorrect?
shouldn't the array be initialized dynamically using new
Just in case that link dies someday...

@ tdk93: this is a feature of C99 (the C language standard of 1999), which works in some C++ compilers, but C++ doesn't officially support it.

The feature is called VLA: variable-length arrays, because the array length is a variable and not a constant.
Last edited on
Topic archived. No new replies allowed.