How do I write int &a
in Delphi?
For example, in C++ it is void ABC(int &a, int &b)
, but I don't know how to write it in Delphi.
That is a reference parameter in C++. In Delphi that corresponds to a var
parameter.
procedure ABC(var a: Integer; var b: Integer);
The documentation says:
Most parameters are either value parameters (the default) or variable (var) parameters. Value parameters are passed by value, while variable parameters are passed by reference.
void ABC(int &a, int &b)
would become
procedure ABC(var a: Integer; var b: Integer);
The var
keyword indicates that you wish to pass the value by reference, rather than value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With