## digitalmars.D.learn - Dynamic multi-dimensional arrays

• Hoenir (7/7) Jan 14 2009 Having a small "problem" here:
• Steve Schveighoffer (9/19) Jan 14 2009 D interprets a new expression with an array index as:
• Hoenir (2/15) Jan 14 2009 Thanks, that works :)
Hoenir <mrmocool gmx.de> writes:
```Having a small "problem" here:
(Tile is a struct)

Tile[][] tiles = new Tile[85][85];

gives me
Error: cannot implicitly convert expression (new
Tile[85u][](cast(uint)85)) of type Tile[85u][] to Tile[][]

I'm trying to understand why that error occurs.
```
Jan 14 2009
Steve Schveighoffer <schveiguy yahoo.com> writes:
```On Wed, 14 Jan 2009 20:32:48 +0100, Hoenir wrote:

Having a small "problem" here:
(Tile is a struct)

Tile[][] tiles = new Tile[85][85];

gives me
Error: cannot implicitly convert expression (new
Tile[85u][](cast(uint)85)) of type Tile[85u][] to Tile[][]

I'm trying to understand why that error occurs.

D interprets a new expression with an array index as:

new T[x]

means create a new dynamic array of type T with x elements.  Your T is
interpreted as:

Tile[85], i.e. a static array.

it's not well known, but you can do this for what you want:

Tile[][] tiles = new Tile[][](85, 85);

-Steve
```
Jan 14 2009
Hoenir <mrmocool gmx.de> writes:
```Steve Schveighoffer schrieb:
D interprets a new expression with an array index as:

new T[x]

means create a new dynamic array of type T with x elements.  Your T is
interpreted as:

Tile[85], i.e. a static array.

it's not well known, but you can do this for what you want:

Tile[][] tiles = new Tile[][](85, 85);

Thanks, that works :)
```
Jan 14 2009