Computer >> Computer tutorials >  >> Programming >> C++

Does C++ support Variable Length Arrays


C++ does not support variable length arrays. The C++11 standard mentions array size as a constant-expression.

So if we write a program in C++ like:

void displayArray(int n) {
   int arr[n];
   // ......
}
int main() {
   displayArray(7);
}
It will not work.