an empty initializer is invalid for an array with unspecified bound
时间: 2024-05-07 21:15:24 浏览: 14
This error message is indicating that you have declared an array without specifying its size (also known as its bound), but you have also tried to initialize it with no elements.
For example, if you declare an array like this:
```
int myArray[];
```
you are not specifying its size, which means the compiler doesn't know how much memory to allocate for it. Then, if you try to initialize it like this:
```
int myArray[] = {};
```
you are essentially trying to declare an array with unspecified size and no elements, which is not allowed.
To fix this error, you need to either specify the size of the array when you declare it, or provide some initial elements in the initializer. For example:
```
int myArray[5]; // specifies the size of the array as 5
int myArray[] = {1, 2, 3}; // initializes the array with 3 elements
```