WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Arrays
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Accessing Multidimensional Arrays

Keywords: 	  Accessing multidimensional arrays 

Question:

Sorry to bother you with a stupid question, but I could'nt find any example to access an array say of three dimensions. The first dimension is explained in the example, but how do I access for example the items in dimension 3?
for x=0 to boondary
message("",[0,0,x])
next

???
For the time I use a really time/memory consuming workaround by taking the items one by one.

Answer:




MyArray=ArrDimension(3,4,5)  ; 3*4*5 or 60 elements

;loading array
For aa=0 To 2
   For bb=0 To 3
       For cc=0 To 4
          MyArray[aa,bb,cc] = aa*20 + bb*5 + cc
       Next
   Next
Next

;Displaying Contents

For aa=0 To 2
   For bb=0 To 3
       For cc=0 To 4
          Pause( StrCat("MyArray[",aa,",",bb,",",cc,"]"), MyArray[aa,bb,cc])
       Next
   Next
Next

Message("App","Done")

Article ID:   W15443
File Created: 2003:05:28:10:19:08
Last Updated: 2003:05:28:10:19:08