[fpc-pascal] Pass array of record as parameter

Zaher Dirkey parmaja at gmail.com
Thu Feb 9 19:24:54 CET 2012


On Thu, Feb 9, 2012 at 8:21 PM, Ludo Brands <ludo.brands at free.fr> wrote:

> **
>
>
>
>
> 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)]);
>
>
Yes, it is good idea, i will try it :D

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120209/1a89191e/attachment.html>


More information about the fpc-pascal mailing list