When the array is declared,the size of an array is supplied in the following way:
dim inquirybyyearmonthday(20)()() as byte

My question is why there are extra 2 opening & closing brackets after (20)?

Recommended Answers

When you do

Dim myarr(2) As Integer

You are declaring an array of integers (indices 0, 1, 2). When you do

Dim myarr(2)() As Integer

You are declaring an array of array of integers. This structure can contain 3 arrays of indeterminate …

Jump to Post

All 3 Replies

 Private Sub byteTest()
        Dim inquirybyyearmonthday(20) As Byte
    End Sub

Do you get an error if you use it like this? I didn't get the extra brackets.

When you do

Dim myarr(2) As Integer

You are declaring an array of integers (indices 0, 1, 2). When you do

Dim myarr(2)() As Integer

You are declaring an array of array of integers. This structure can contain 3 arrays of indeterminate length as in

Dim myarr(2)() As Integer

myarr(0) = {1, 2, 3}
myarr(1) = {4, 5}
myarr(2) = {6, 7, 8, 9}

dim inquirybyyearmonthday(20)()() as byte

So to clarify further.... an array that contains 20 arrays of undetermined length that themselves contain arrays of undetermined length... of type byte

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.