正在加载图片...
Example: procedure muchAddx, y: 7: varz:万 egin 2:XX:yy:=2 end A call muchAdo (a, b) has the following effect X: =a,i pass the value of a to Xy y:=b,i pass the value of b to y) Z:=XX: =Ny: =Z a and b are unchanged y The program segment does not change a or b, though the values of x and y are indeed exchanged 如果想用此方法来交换两个数的值可能达不到目的。Example: procedure muchAdo(x, y : T); var z : T; begin z := x; x := y; y := z; end A call muchAdo(a,b) has the following effect: x := a; { pass the value of a to x } y := b; { pass the value of b to y } z := x; x := y; y := z; { a and b are unchanged } The program segment does not change a or b, though the values of x and y are indeed exchanged. 如果想用此方法来交换两个数的值可能达不到目的
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有