Dynamic multidimensional array?

Previous topic - Next topic

JohnnyB

is this possible?

dim x[44][]

does not work, e.g.


JohnnyB


erico

I´m not sure I understand what you are looking for and its use, but wouldn´t REDIM help?
If it´s more complex, better wait for the more pro people to chip in on the subject.

SnooPI

#3
Maybe something like that :

Code (glbasic) Select


LOCAL x[]
DIM x[44][1]

DMA(x[], 4)

x[0][0] = 506
x[10][1] = 10
x[7][2] = 1004
x[25][3] = 99
x[42][4] = 2019

PRINT x[0][0], 0, 10
PRINT x[10][1], 0, 20
PRINT x[7][2], 0, 30
PRINT x[25][3], 0, 40
PRINT x[42][4], 0, 50

DMA(x[], 2)

x[1][5] = 52
x[37][6] = 308

PRINT x[1][5], 0, 70
PRINT x[37][6], 0, 80

SHOWSCREEN
MOUSEWAIT
END

FUNCTION DMA: a[], n%
LOCAL s1%, s2%

s1 = BOUNDS(a[], 0)
s2 = BOUNDS(a[], 1)

REDIM a[s1][s2 + n]
ENDFUNCTION