C/C++ Compiler (cl.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
C2540
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     Compiler error C2540
 
     nonconstant 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
                                    -♦-