SHARED Array values with SUBs and FUNCTIONs
#8
(06-22-2023, 04:05 PM)bplus Wrote:
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.  [Image: huh.png]


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?
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.
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.
[Image: Re-Dim-Array2023-06-22.jpg]
Reply


Messages In This Thread
RE: SHARED Array values with SUBs and FUNCTIONs - by Kernelpanic - 06-22-2023, 04:21 PM



Users browsing this thread: 2 Guest(s)