an array question

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: an array question

  1. #1
    Deborah D Brown Guest

    an array question

    I'm going thru a book learning about web services, and i'm on the part about
    returning arrays. Examine:

    Dim myArray(2) as pcdebbArray

    This is an array of TWO elements or THREE? The book states this is an array
    of three items, I know it supposed to be zero based so when I reference them
    it will be myArray(0), my Array(1), etc, but this really confused me?

  2. #2
    Paul Mc Guest

    Re: an array question

    G'day Deborah.

    >Dim myArray(2) as pcdebbArray

    Yes this can be confusing. That declaration is functionally identical to:
    Dim myArray(0 to 2) as pcdebbArray
    i.e. the 2 declares the Upper Bound of the array, when the array's lower
    bound is 0.

    The easiest way IMO to remember is just to mentally translate
    Dim myArray(x) -> Dim myArray(0 to x).


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center