R
R Avery
When I have two arrays, Ar1 and Ar2, whenever I set Ar2=Ar1, it copies
Ar1 to another location and sets Ar2 equal to that clone... so that they
are not pointing to the same memory. Is there anyway to change this
behavior so that both Ar1 and Ar2 point to the same location in memory?
For example, how would I modify the following code to do print out the
same value. Perhaps the CopyMemory or other API function?
Sub ArrayTest()
Dim Ar1(2) As Long, Ar2() As Long
Ar1(0) = 190
Ar1(1) = 190
Ar1(2) = 190
Ar2 = Ar1
Ar2(1) = 222
Debug.Print Ar2(1), Ar1(1)
End Sub
Ar1 to another location and sets Ar2 equal to that clone... so that they
are not pointing to the same memory. Is there anyway to change this
behavior so that both Ar1 and Ar2 point to the same location in memory?
For example, how would I modify the following code to do print out the
same value. Perhaps the CopyMemory or other API function?
Sub ArrayTest()
Dim Ar1(2) As Long, Ar2() As Long
Ar1(0) = 190
Ar1(1) = 190
Ar1(2) = 190
Ar2 = Ar1
Ar2(1) = 222
Debug.Print Ar2(1), Ar1(1)
End Sub