编写如下程序: Private Sub Command 1_SClick() Dim x As Intege,y As Integer x=10:y=20 Call funl(x,y) Print x;y End Sub Private Function

admin2015-05-29  12

问题 编写如下程序:
Private Sub Command 1_SClick()
Dim x As Intege,y As Integer
x=10:y=20
Call funl(x,y)
Print x;y
End Sub
Private Function fun l(ByVal m As Integer,n As Integer)As Integer
m=m*m:n=n+n
End Function
程序运行后,单击命令按钮Command1,输出结果为

选项 A、10 25
B、10 40
C、100 25
D、100 40

答案B

解析 在Visual Basic中调用过程时,参数有两种传递形式:按值传递(Byval)和按址传递(Byref),默认为按址传递。其中,当参数按址传递时,如果在引用该参数的过程中改变了形参的值,同时也就改变了传递参数时实参变量的值。本题中funl的参数m是按值传递的,n是按地址传递的,因此在funl中对m的改变不会影响实参x,对n的操作会影响实参y。
转载请注明原文地址:https://kaotiyun.com/show/VCQp777K
0

随机试题
最新回复(0)