Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
REDIM takes more resources than DIM?
#26
Dynamic arrays are always created when no constant value is specified in the DIM statement - but also arrays declared as COMMON are declared dynamically.

OK, that's how it works. But I stick to my opinion that I have already expressed: Personally, I think it is wrong to declare an array with ReDim... that is confusing. For me, the clear line is lost.

Code: (Select All)

Option Base 1

ReDim As Integer feld(5, 5)

feld(1, 2) = 3
Print feld(1, 2)

ReDim feld(4, 7)

feld(3, 5) = 12
Print feld(3, 5)

ReDim feld(5, 5)

feld(2, 2) = 7
Print feld(2, 2)

'---------------------------------------

Dim As Integer a, b

'Jetzt wird feld2() dynamisch deklariert
'Now the array is created dynamically.
a = 5
b = 7
Dim As Integer feld2(a, b)

feld2(2, 2) = 8
Print feld2(2, 2)

ReDim feld2(b, a)

feld2(4, 2) = 10
Print feld2(4, 2)
Reply


Messages In This Thread
REDIM takes more resources than DIM? - by bplus - 07-17-2024, 12:21 AM
RE: REDIM takes more resources than DIM? - by Kernelpanic - 07-18-2024, 05:44 PM



Users browsing this thread: 4 Guest(s)