As a beginner, my question is if an array is passed byval, what on earth the parameter get? I know that array is kind of reference type. and my guess is that the array parameter byval (hold the array from the argument) should get the copy of the reference of the argument hold, and so, once the sub ArrayProcByRef changed element in the array parameter, the argument should change either.
Sub Main() Handles MyBase.Load
Dim Array1(10) As Integer
Dim Array2(10) As Integer
ArrayProcByRef(Array1, Array2)
Console.WriteLine(UBound(Array1))
Console.WriteLine(UBound(Array2))
Console.WriteLine(Array1(2))
Console.WriteLine(Array2(2))
End Sub
Sub ArrayProcByRef(ByVal arr1() As Integer, ByRef arr2() As Integer)
ReDim arr1(100)
ReDim arr2(100)
arr1(2) = 11
arr2(2) = 22
End Sub
above is my code, it is easy, and the output is 10,100,0,22 anyone could give a tip?