Delen via


Compilerfout C2540

niet-constante expressie als matrixgrens

Opmerkingen

Een array moet een constante grens hebben.

Example

In het volgende voorbeeld wordt C2540 gegenereerd:

// C2540.cpp
void func(int n, int pC[]) {
   int i = ((int [n])pC)[1];   // C2540
}

void func2(int n, int pC[]) {
   int i = (pC)[1];   // OK
}

int main() {
   int pC[100];
   func(100, pC);
   func2(100, pC);
}