Re: Array operations with multidimensional arrays

2016-11-19 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 19 November 2016 at 21:05:49 UTC, John Colvin wrote: On Saturday, 19 November 2016 at 19:36:50 UTC, Marduk wrote: Thanks a lot! Now I get what it means that array declarations are read from right to left. The way I think about it is this: int is a type. int[3] is an array of 3

Re: Array operations with multidimensional arrays

2016-11-19 Thread John Colvin via Digitalmars-d-learn
On Saturday, 19 November 2016 at 19:36:50 UTC, Marduk wrote: On Saturday, 19 November 2016 at 17:37:58 UTC, John Colvin wrote: On Saturday, 19 November 2016 at 10:20:16 UTC, Marduk wrote: Additionally, I would like to assign 2D sub-arrays of a 3D array, i.e. something like the following:

Re: Array operations with multidimensional arrays

2016-11-19 Thread Marduk via Digitalmars-d-learn
On Saturday, 19 November 2016 at 17:37:58 UTC, John Colvin wrote: On Saturday, 19 November 2016 at 10:20:16 UTC, Marduk wrote: Additionally, I would like to assign 2D sub-arrays of a 3D array, i.e. something like the following: int[3][2][2] a; a[0] = [[2,2], [2,2]]; You have the dimensions

Re: Array operations with multidimensional arrays

2016-11-19 Thread John Colvin via Digitalmars-d-learn
On Saturday, 19 November 2016 at 10:20:16 UTC, Marduk wrote: Additionally, I would like to assign 2D sub-arrays of a 3D array, i.e. something like the following: int[3][2][2] a; a[0] = [[2,2], [2,2]]; You have the dimensions the wrong way around. a is a 2 element array of 2 element arrays

Array operations with multidimensional arrays

2016-11-19 Thread Marduk via Digitalmars-d-learn
In the documentation one can learn how to do array operations with 1D arrays. However, this does not scale up for 2D arrays. For example, the following does not work: int[2][2] a,b; a = [[1,1],[1,1]]; b[][] = a[][]*2; Additionally, I would like to assign 2D sub-arrays of a 3D array, i.e.