
dim and redim allocate memory?
Dim is more of a compiler directive in that it establishes the type of
variable declared, reserving the appropreate amount of memory at compile
time. Dim statements do not get executed at runtime.
ReDim is an executable statement, it therefore does allocate memory when
it executes.
The Option Base feature allows the programmer to determine if 0 or 1 is
used as the (default) lower bound value of an array. This value should
be included in the Dim statement so there is no question about the lower
bound:
Instead of:
Dim Records(100)
Use:
Dim Records(0 To 100)
HTH
LFS
Quote:
> Hi,
> Does a dim statemen as in dim array(0) as string actually allocate memory or
> is it nothing more than a declaration that needs to be initialized with some
> values before memory is allocated. What about redim? Is memory being
> reserved there?
> Also C++ starts its array counters at 0 (a[0] is the first element). Does
> visual basic the same or a[1] is the first element of the array?
> Thanks for your time.