K kadi88 Unregistered / Unconfirmed GUEST, unregistred user! 2001-12-23 #1 1、在函数中对值参数的改变不会影响到相应的实在参数。 2、在函数中对变量参数的运算实际上是对实在参数的运算, 因此在函数中改变了变量参数的值,也就改变了相应实在参数的值。
C Celestial dog Unregistered / Unconfirmed GUEST, unregistred user! 2001-12-23 #2 去看书!!!懒虫!!!! 这么简单的问题也问?? 这里不是托儿所!!!!
A andriy Unregistered / Unconfirmed GUEST, unregistred user! 2001-12-23 #4 procedure test1(x,y:integer); begin x:=x+5; y:=y+10; showmessage('x='+IntToStr(x)+','+'y='+IntToStr); end; procedure test2(var x,y:integer); begin x:=x+5; y:=y+10; showmessage('x='+IntToStr(x)+','+'y='+IntToStr); end; procedure Tform1.Button1Click(Sender: TObject); var x,y:integer; begin x:=5; y:=10; test1(x,y); showmessage('x='+IntToStr(x)+','+'y='+IntToStr);//x=5,x=10; test2(x,y); showmessage('x='+IntToStr(x)+','+'y='+IntToStr);//x=10,x=20; end; 明白了吧
procedure test1(x,y:integer); begin x:=x+5; y:=y+10; showmessage('x='+IntToStr(x)+','+'y='+IntToStr); end; procedure test2(var x,y:integer); begin x:=x+5; y:=y+10; showmessage('x='+IntToStr(x)+','+'y='+IntToStr); end; procedure Tform1.Button1Click(Sender: TObject); var x,y:integer; begin x:=5; y:=10; test1(x,y); showmessage('x='+IntToStr(x)+','+'y='+IntToStr);//x=5,x=10; test2(x,y); showmessage('x='+IntToStr(x)+','+'y='+IntToStr);//x=10,x=20; end; 明白了吧