Author Topic: Dynamic multidimensional array?  (Read 768 times)

JohnnyB

• Mc. Print
• Posts: 40
Dynamic multidimensional array?
« on: 2019-Aug-21 »
is this possible?

dim x[44][]

does not work, e.g.

JohnnyB

• Mc. Print
• Posts: 40
Re: Dynamic multidimensional array?
« Reply #1 on: 2019-Aug-22 »
bump

erico

• Community Developer
• Prof. Inline
• Posts: 4349
Re: Dynamic multidimensional array?
« Reply #2 on: 2019-Aug-23 »
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

• Dr. Type
• Posts: 375
Re: Dynamic multidimensional array?
« Reply #3 on: 2019-Aug-23 »
Maybe something like that :

Code: (glbasic) [Select]
`LOCAL x[]DIM x[44][1]DMA(x[], 4)x[0][0] = 506x[10][1] = 10x[7][2] = 1004x[25][3] = 99x[42][4] = 2019PRINT x[0][0], 0, 10PRINT x[10][1], 0, 20PRINT x[7][2], 0, 30PRINT x[25][3], 0, 40PRINT x[42][4], 0, 50DMA(x[], 2) x[1][5] = 52x[37][6] = 308PRINT x[1][5], 0, 70PRINT x[37][6], 0, 80SHOWSCREENMOUSEWAITENDFUNCTION DMA: a[], n% LOCAL s1%, s2% s1 = BOUNDS(a[], 0) s2 = BOUNDS(a[], 1) REDIM a[s1][s2 + n]ENDFUNCTION `
« Last Edit: 2019-Aug-23 by Snoopy »