[问题] 传址传值

楼主: hatvito (跳~跳~跳)   2011-07-08 22:17:37
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim x As Integer
x = 3
Call f1(x)
Debug.Print(x)
End Sub
Sub f1(ByRef x As Integer)
Call t2(x = x + x, x, x)
End Sub
Sub t2(ByRef a As Integer, ByVal b As Integer, ByRef c As Integer)
a = a + 1
b = b + 2
c = a + b * c
End Sub
结果是16
问题是出在A
A执行结果是1
也就是说A收到的零
为什么呢?
作者: CaptainH (Cannon)   2011-01-17 02:09:00
常数0怎么reference ?
作者: zerof (猫橘毛发呆雕像)   2011-07-22 20:20:00
x= x+x 里面的等号是compare的意思(所以值传入0)

Links booklink

Contact Us: admin [ a t ] ucptt.com