做题目遇到传址、传值呼叫,只要题目难一点就会一直卡住。
请问下面两题如何计算?
1.VB
Private Sub Form_Activate( )
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.
请问最后印出?
2.C/C++
int f1(int y){y=y+1; return y;}
int f2(int &y){y=y+1; return y;}
int f3(int *y){*y=*y+1; return *y;}
void main(){
int a,b,c,d,x=1;
a=f1(x);
b=f2(x);
c=f3(&x);
d=x++;
}
请问d值?