[求助]请教 传址与传值???
Public Sub swap1(ByVal x As Integer, y As Integer)
Dim t As Integer
t = x: x = y: y = t
End Sub
Public Sub swap2(x As Integer, y As Integer)
Dim t As Integer
t = x: x = y: y = t
End Sub
Private Sub Command1_Click()
Dim a As Integer, b As Integer
a = 10: b = 20
swap1 a, b
Print "A1="; a, "B1="; b
a = 10: b = 20
swap2 a, b
Print "A2="; a, "B2="; b
End Sub
传值的结果怎么A1=10;B1=10?很是奇怪,麻烦大侠帮忙解释一下
形参里面x=10,y=20
为什么出来后就成A1=10;B1=10