Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth
Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

42,844 questions

55,671 answers

573 users

How to declare, initialize and print Jagged array (array of uneven arrays) of integers in VB.NET

1 Answer

0 votes
Module Module1

    Sub Main()

        Dim jagged()() As Integer = New Integer(3)() {}

        Dim arr1() = New Integer() {1, 2, 3}
        jagged(0) = arr1

        Dim arr2() = New Integer() {44, 66}
        jagged(1) = arr2

        Dim arr3() = New Integer() {1237, 5354, 7643, 7236, 9833}
        jagged(2) = arr3

        jagged(3) = New Integer() {888, 555, 999, 111, 333, 222}

        For i As Integer = 0 To jagged.Length - 1
            Dim subarray As Integer() = jagged(i)
            For a As Integer = 0 To subarray.Length - 1
                Console.Write("{0, 5}", subarray(a))
                Console.Write(" ")
            Next
            Console.WriteLine()
        Next


    End Sub

End Module

'run:
' 
'    1     2     3
'   44    66
' 1237  5354  7643  7236  9833
'  888   555   999   111   333   222

 



answered Mar 4, 2016 by avibootz
...