06-22-2023, 04:21 PM
(This post was last modified: 06-22-2023, 04:31 PM by Kernelpanic.)
(06-22-2023, 04:05 PM)bplus Wrote:We had a long discussion about "ReDim" & Co. ReDim has nothing to do with static or dynamic arrays, first of all. Everything is up for discussion.Quote:@bplus - "ReDim" is useless here, since it has not yet been initialized. - The output is interesting. I know how that happens, but was that intentional? I don't really understand what you're trying to show.
KP,
ReDim was not needed in this example, no, but who gives a flying fur ball?! ReDim is good habit to use for output arrays from Subs and Functions so they can change the dimensions if that is their function or routine to do. Why restrict to Static arrays when Dynamic ones are so much more flexible with upper and lower bounds?
ReDim is only used to resize a dynamic array. Ultimately, if you use that for declaration, the confusion is total.
Again, dynamic arrays are created whenever no constant value is specified in the DIM statement.
Code: (Select All)
Dim As Integer rows, cols
rows = 10
cols = 12
Dim grid(row, cols) 'Dynamic array
ReDim grid(14, 10)
Dim out10(1 To 10) As Integer is no a dynamic array.