DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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).

    HTH,
    Cheers,
    Paul

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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links