Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 583 Bytes

compiler-error-c2540.md

File metadata and controls

32 lines (26 loc) · 583 Bytes
descriptiontitlems.datef1_keywordshelpviewer_keywordsms.assetid
Learn more about: Compiler Error C2540
Compiler Error C2540
11/04/2016
C2540
C2540
92c805a3-2dd9-46ca-a63d-3845c18ecc95

Compiler Error C2540

non-constant expression as array bound

An array must have a constant bound.

The following sample generates C2540:

// C2540.cppvoidfunc(int n, int pC[]) { int i = ((int [n])pC)[1]; // C2540 } voidfunc2(int n, int pC[]) { int i = (pC)[1]; // OK } intmain() { int pC[100]; func(100, pC); func2(100, pC); }
close