Re: Playing with multidimensional array!?
- From: "Al Dunbar" <AlanDrub@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Nov 2007 23:42:58 -0700
In traditional compiler languages, rows and columns are differentiated by
the fact that a two dimensional array occupies contiguous storage locations.
A 2x2 array would then consist of these four elements: a(0,0), a(0,1),
a(1,0), a(1,1) in that order. Or maybe this order: a(0,0), a(1,0), a(0,1),
a(1,1). Not only do I forget this detail, I always had trouble remembering
it in the first place, as it always seemed counterintuitive.
Regardless, one could code in such a way that the order was considere
row,column, or column,row - as long as one consistently followed the same
convention.
Scripting languages like vbscript store their arrays in quite a different
fashion, so the distinction is probably even less important, except for the
fact that redim can affect only the last dimension. Some people even
consider these the first dimension and the second dimension rather than row
and column (or vice versa). And that rather bland approach tends to make it
simpler when going to higher order arrays having a third or fourth
dimension. Now, was that row, column, plane, time or column,plane,time,
row???
see:
http://www.emu.edu.tr/english/facilitiesservices/computercenter/bookslib/Laura%20Lemay's%20Web%20Workshop%20ActiveX%20And%20VBScript/f10-5.gif
..
/Al
"Claude Lachapelle" <ClaudeLachapelle@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:5EFB99AB-35C3-4D89-9DCC-B4B30483FDFE@xxxxxxxxxxxxxxxx
I agree -- like I saw suggested, arrays in arrays, that could be row,
column
(the second dimension is another array).
I never programmed an array to be accessible beginning by the column -- C,
C+, Pascal, Turbo Pascal, dBase, Clipper (I'm an old timers programmers,
sorry).
Thanks.
"McKirahan" wrote:
"Claude Lachapelle" <ClaudeLachapelle@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:1BD75497-1FD8-41A2-A7C1-B1C53FB895B0@xxxxxxxxxxxxxxxx
Thanks a lot for your help.
Correct me if I'm wrong (I really found that unusual!), but when
accessing
data into the two dimensions array, the first parameters is always the
column, and the second one the row...
I wouldn't say "always".
To read the data in my array you might use:
Dim iCol, iRow
For iRow = 0 To UBound(aMailboxes,2)
For iCol = 0 To UBound(aMailboxes,1)
WScript.Echo iRow & "." & iCOL & " = " & aMailboxes(iCol,iRow)
Next
Next
I'm always confused with that since others old programming languages
are
functionning by beginning by the row...
I've worked in COBOL, Fortran, et.al. and it was I
(the progrmammer) that determined what index meant what.
[snip]
.
- References:
- Re: Playing with multidimensional array!?
- From: McKirahan
- Re: Playing with multidimensional array!?
- From: Claude Lachapelle
- Re: Playing with multidimensional array!?
- From: McKirahan
- Re: Playing with multidimensional array!?
- From: Claude Lachapelle
- Re: Playing with multidimensional array!?
- Prev by Date: Re: How to Create a ListBox
- Next by Date: Re: File Copy with ouput to log
- Previous by thread: Re: Playing with multidimensional array!?
- Next by thread: Re: Playing with multidimensional array!?
- Index(es):
Relevant Pages
|