Closed sine707 closed 1 year ago
Two dimensional arrays are nothing more than linear data.
Try this:
DIM testvalues(3,3) AS BYTE @testdata
FOR i AS BYTE = 0 TO 2
PRINT testvalues(0, i), testvalues(1, i), testvalues(2, i)
NEXT i
testdata:
DATA AS BYTE 1, 2, 3
DATA AS BYTE 4, 5, 6
DATA AS BYTE 7, 8, 9
' Note that the following is identical
' DATA AS BYTE 1, 2, 3, 4, 5, 6, 7, 8, 9
Thank you!
I think had the order wrong, as I was thinking testvalues(index, value)
instead of the other way around.
This makes sense now.
I'm glad that I could help. It might not be intuitive how array elements are laid out in memory, but it is what it is.
Is it currently possible to populate a two-dimensional array with DATA? I wasn't able to find it in the docs and my experiments have failed thus far.