หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
non-constant expression as array bound
An array must have a constant bound.
The following sample generates 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);
}