Error del compilador C2540

expresión no constante como límite de matriz

Observaciones

Una matriz debe tener un límite constante.

Example

En el ejemplo siguiente se genera el error C2540:

// 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);
}