In C++ books, array bound must be constant expression, but why the following code works?

This a a C99 feature called VLA which some compilers also allow in C++. It’s allocation on stack, just as it would be with int a[10].

Leave a Comment