
-----------------------------------
Nathan4102
Fri Dec 12, 2014 9:58 pm

MultiDimensonal Array Question
-----------------------------------
Silly Question...

For a multidimensional array in Turing, e.g.

var mapShapes : array 1 .. 23, 1 .. 4, 1 .. 2 of int

Is there syntax to access/assign the 1d/2d arrays within mapShapes? e.g. 2D - mapShapesmapShapes(x, y) = (1, 2)

-----------------------------------
Zren
Fri Dec 12, 2014 11:53 pm

RE:MultiDimensonal Array Question
-----------------------------------
In Turing, you can't really treat a multidimensional array like it's an array of an array unfortunately. At least not with that syntax.


var a : array 1 .. 1, 1 .. 1 of int
var b : array 1 .. 1 of array 1 .. 1 of int

a (1, 1) := 1
b (1) (1) := 1

var c : array 1 .. 1 of int := init (1)
b (1) := c


You need to define the array like b is defined.

-----------------------------------
Raknarg
Sat Dec 13, 2014 6:47 pm

RE:MultiDimensonal Array Question
-----------------------------------
Wow I never knew they were different, I assumed they were functionally identical.

-----------------------------------
Nathan4102
Sat Dec 13, 2014 9:22 pm

RE:MultiDimensonal Array Question
-----------------------------------
Huh I didn't even know arrays could be declared like b. It'll work for me, thanks!
