+ Reply to Thread
Results 1 to 5 of 5

array initialization

  1. #1
    Registered User
    Join Date
    06-21-2007
    Location
    Vancouver, Canada
    Posts
    74

    array initialization

    If I have the following code

    Please Login or Register  to view this content.
    Would all the entries in A be initialized to 0 by default?

    Thanks,

    Stanley

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Yes; numeric variables are initialized to zero, Variants to Empty, object variables to Nothing, variable-length strings to vbNullString, fixed-length strings to nulls, and user-defined types to the values appropriate to their internal types.

    And
    Please Login or Register  to view this content.
    will set them all back to zeros.

  3. #3
    Registered User
    Join Date
    06-21-2007
    Location
    Vancouver, Canada
    Posts
    74
    I'm also unsure about the amount of columns and rows A has. Does A have 5 columns and 1000000 rows?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    You're welcome. Oops -- never mind!

    A has 5 or 6 rows, and 1000000 or 1000001 columns, depending. See VBA Help for the Option Base statement.

    You should declare arrays extents explicitly:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-21-2007
    Location
    Vancouver, Canada
    Posts
    74
    I found out in the code by typing A( else to see that it's 0 to 5, 0 to 1000000. So it has 6 rows and 1000001 columns. I'm currently reading someone else's code that I'm supposed to modify and just got confused about that array.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1