Does C++ support Variable Length Arrays

C++Server Side ProgrammingProgramming

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.
raja
Published on 29-Mar-2019 11:50:16
Advertisements