Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C2466

Error Message

cannot allocate an array of constant size 0

An array is allocated or declared with size zero. The constant expression for the array size must be an integer greater than zero. An array declaration with a zero subscript is legal only for a class, structure, or union member and only with Microsoft extensions (/Ze).

The following sample generates C2466:

// C2466.cpp
// compile with: /c
int i[0];   // C2466
int j[1];   // OK
char *p;

Community Additions

ADD
Show:
© 2015 Microsoft