[fpc-pascal] Pass array of record as parameter

Ludo Brands ludo.brands at free.fr
Thu Feb 9 19:21:11 CET 2012


 



Thanks, but that is not my expected answer, my ask about "dynamic array of
record" and without define a variable to pass it by params, for example i
can pass the params for array of string like this

func2(['t1', 't1']); this work, but i want to extend the params info?



You can use a small helper function like this:
 
 
type
  TInfo=record
    s: string;
    i: integer;
  end;

  function makeinfo(s:string;i:integer):TInfo;
  begin
    result.s:=s;
    result.i:=i;
  end;

...
 
  func1([makeinfo('test1', 1), makeinfo('test2', 2)]);

 
 Ludo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120209/84c0d2b6/attachment.html>


More information about the fpc-pascal mailing list