Declare multi-dimensional array size dynamically?

# Thread: Declare multi-dimensional array size dynamically?

1. Junior Member
Join Date
Dec 1969
Posts
24

## Declare multi-dimensional array size dynamically?

Is it possible in ASP to declare a multi-dimensional array size dynamically? e.g. Dim blah(x, y)<BR><BR>If not, I&#039;ll present my problem: I&#039;ve got a 2D array, and I&#039;m trying to write a function to flip-flop it. Basically, convert this:<BR><BR>A B C<BR>D E F<BR><BR>to this:<BR><BR>A D<BR>B E<BR>C F<BR><BR>Any help would be awesome..thanks!

2. Senior Member
Join Date
Dec 1969
Posts
497

## Why bother to flip flop

just swap the index numbers...<BR><BR>for example myArray(i,j) flip flops myArray(j,i)<BR><BR><BR>right??

3. Junior Member
Join Date
Dec 1969
Posts
24

## RE: Why bother to flip flop

Because I&#039;m passing the whole array to a 3rd party component that is displaying the array in a different order than I want. I have to flip-flop the whole array then pass it to the 3rd party component.

4. Senior Member
Join Date
Dec 1969
Posts
497

## Redim

I think this works:<BR><BR>[code language="vbscript"]<BR>Function flipFlop(startArray)<BR> dim tempArray<BR> rows = ubound(startArray,1)<BR> cols = ubound(startArray,2)<BR> redim tempArray(cols,rows)<BR> for j = 0 to rows-1<BR> for i = 0 to cols-1<BR> tempArray(i,j) = startArray(j,i)<BR> next<BR> next<BR> flipFlop = tempArray <BR>End Function<BR>[/code]<BR><BR>

5. Junior Member
Join Date
Dec 1969
Posts
24

## RE: Redim

Yes, that does work...awesome! Thanks!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•