Error "An array may not have elements of this type"

arrays, c++

Solution

In C/C++ you cannot define a bi-dimensional array with two unknown size as in `char _adr[][]`. Arrays declarations must have all, but the first, sizes defined. Try defining at least one size (example: `char _adr[][10]`) or, since you are using C++, use an `std::vector` instead.

Just to make you notice it: you are also using the `adr` without declaring it in the scope of the function.

Problem

I`ve problem compiling my program because of this strange compile error...here is the concrete part of code: ``` // the error occures at "char _adr[][]" in the constructor parameters Addresses(string _ime, string _egn, char *_adres, char _adr[][], int adrLen):Person(_ime, _egn, _adres){ addressLength = 0; for(; addressLength < adrLen; addressLength++) { if(addressLength >= 5){ break; } adr[addressLength] = _adr[addressLength]; } } ```

Original source