Skip to content

Commit 7f04da3

Browse files
authored
Tweak error C2466
1 parent a5882df commit 7f04da3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
description: "Learn more about: Compiler Error C2466"
32
title: "Compiler Error C2466"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2466"
4+
ms.date: "03/19/2025"
55
f1_keywords: ["C2466"]
66
helpviewer_keywords: ["C2466"]
7-
ms.assetid: 75b251d1-7d0b-4a86-afca-26adedf74486
87
---
98
# Compiler Error C2466
109

11-
cannot allocate an array of constant size 0
10+
> cannot allocate an array of constant size 0
1211
1312
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](../../build/reference/za-ze-disable-language-extensions.md)).
1413

@@ -17,7 +16,6 @@ The following sample generates C2466:
1716
```cpp
1817
// C2466.cpp
1918
// compile with: /c
20-
int i[0]; // C2466
21-
int j[1]; // OK
22-
char *p;
19+
int arr1[0]; // C2466
20+
int arr2[1]; // OK
2321
```

0 commit comments

Comments
 (0)