Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Three-dimensional array
#12
one tip:
_PRESERVE works only with monodimensional array... 
moreover it is the exact duplicate of _PRESERVE of QB7.1 / QB PDS

run this code to catch the issue
Code: (Select All)
'$dynamic
ReDim threeDim(1 To 10, 1 To 5, 1 To 3)
Screen _NewImage(100, 30, 0)
For a = 1 To 10
    For b = 1 To 5
        For c = 1 To 3
            threeDim(a, b, c) = a + (b * 10) + (c * 100)
            First$ = First$ + Str$(threeDim(a, b, c)) + "/"
    Next c, b
    First$ = First$ + "|"
Next a
Print First$
Print "<------------------------------------------------->"

ReDim _Preserve threeDim(1 To 12, 1 To 5, 1 To 5)

For a = 1 To 12
    For b = 1 To 5
        For c = 1 To 5
            Second$ = Second$ + Str$(threeDim(a, b, c)) + "/"
    Next c, b
    Second$ = Second$ + "|"
Next a
Print Second$

This lets suppose that array is a stack and not a set of cell of memory ordered by pointers.
Reply


Messages In This Thread
Three-dimensional array - by Kernelpanic - 01-03-2023, 06:39 PM
RE: Three-dimensional array - by bplus - 01-03-2023, 07:38 PM
RE: Three-dimensional array - by SpriggsySpriggs - 01-03-2023, 07:40 PM
RE: Three-dimensional array - by mnrvovrfc - 01-03-2023, 07:46 PM
RE: Three-dimensional array - by SMcNeill - 01-03-2023, 07:56 PM
RE: Three-dimensional array - by TempodiBasic - 01-03-2023, 11:13 PM
RE: Three-dimensional array - by Kernelpanic - 01-03-2023, 08:36 PM
RE: Three-dimensional array - by TempodiBasic - 01-03-2023, 11:07 PM
RE: Three-dimensional array - by Kernelpanic - 01-04-2023, 10:12 PM
RE: Three-dimensional array - by SMcNeill - 01-04-2023, 10:57 PM
RE: Three-dimensional array - by TerryRitchie - 01-04-2023, 11:41 PM
RE: Three-dimensional array - by Kernelpanic - 01-06-2023, 03:20 PM
RE: Three-dimensional array - by TempodiBasic - 01-05-2023, 09:07 PM
RE: Three-dimensional array - by mnrvovrfc - 01-05-2023, 10:07 PM
RE: Three-dimensional array - by TerryRitchie - 01-05-2023, 10:04 PM
RE: Three-dimensional array - by SpriggsySpriggs - 01-06-2023, 03:48 PM
RE: Three-dimensional array - by SMcNeill - 01-07-2023, 12:17 AM
RE: Three-dimensional array - by James D Jarvis - 01-07-2023, 04:53 AM
RE: Three-dimensional array - by mnrvovrfc - 01-07-2023, 06:41 AM
RE: Three-dimensional array - by TempodiBasic - 01-07-2023, 11:55 AM
RE: Three-dimensional array - by TempodiBasic - 01-08-2023, 05:39 PM



Users browsing this thread: 1 Guest(s)