delphi 参数的传址与传值
2021-06-16 21:05
标签:var fun integer delphi cti func val eva ble function DoubleVal (Val: Integer) : Integer; function DoubleRef (var Val: Integer): Integer; delphi 参数的传址与传值 标签:var fun integer delphi cti func val eva ble 原文地址:https://www.cnblogs.com/bwdblogs/p/10344893.html
begin
Val := Val * 2;
Result := Val;
end;
begin
Val := Val * 2;
Result := Val;
end;
调用:
var
I, J: Integer;
begin
I := 2;
J := DoubleVal (I); // I = 2; J = 4;
//如果调用下面的话,
// J := DoubleRef (I); // I = 4; J = 4; i的值改变了