Compiler Error C2540

non-constant expression as array bound

The specified array bound was not a constant expression.

An array must be declared with a constant bound.

The following example shows an illegal way to declare an array:

int i;
int A[i];        // error, i is nonconstant

and legal ways to declare an array:

const j = 20;
int A[j];        // OK, j is constant
int B[32];       // OK, 32 is a literal