(27)下列函數(shù)過(guò)程 Function Func(a As Integer,b As Integer)As Integer Static m As Intege
(27)下列函數(shù)過(guò)程 Function Func(a As Integer,b As Integer)As Integer Static m As Integer,i As Integer M=0 i=2 A=i+m+1 b=i+a+b Func2=m End Function Private Sub Command1_Click() Dim p As Integer,k As Integer,m As Integer k=4 m=1 P=Func2(k,m) Print k;m End Sub程序運(yùn)行后,單擊命令按鈕,輸出結(jié)果是 A.3 6<CR>3 6 B.3 6<CR>3 11C.3 11<CR>3 6 D.3 11<CR>3 11
正確答案:B【解析】本題意在考查調(diào)用Func2時(shí),參數(shù)是按地址傳遞的,所以兩次調(diào)用Func2時(shí),實(shí)參k、m的值都改變了。程序運(yùn)行過(guò)程如下:第一次調(diào)用Func2(k,m),k被行參a改變?yōu)?,m被行參改變?yōu)?;第二次調(diào)用函數(shù)后,a為3,m為11。
詞條內(nèi)容僅供參考,如果您需要解決具體問(wèn)題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢相關(guān)領(lǐng)域?qū)I(yè)人士。