编写如下程序: Private Sub Command1—Click()DimXAs Integerx=10 Print funl(x,12)+x End Sub Private Function fiml(mAs Integer,nAs Integer)

admin2019-01-17  19

问题 编写如下程序:
Private Sub Command1—Click()DimXAs Integerx=10
Print funl(x,12)+x
End Sub
Private Function fiml(mAs Integer,nAs Integer)As Integer
Ifn>10 Then m=n
funl=m+n
End Function
程序运行后,单击命令按钮Commandl,输出结果为

选项 A、30
B、32
C、34
D、36

答案D

解析 本体是一个简单的函数调用,调用fun1函数时将x的值作为实参传送给funl函数,由于第二个参数12满足n>10,会将形参m的值也改变为12,因返回的函数值为24:由于函数ftnl的各个参数为地址传递,因此对于形参m的值会影响实参x的值,即x的值也变为12。
转载请注明原文地址:https://kaotiyun.com/show/M0Fp777K
0

最新回复(0)