[fpc-pascal] Varriable number of parameters
Anandu R Suri
zmatrix13 at flashmail.com
Thu May 12 05:52:30 CEST 2005
Hi, how can I create procedure with undefined number of parrameters. Writeln
is example of what I am looking for for example procedure add(a,b,c,.... var
result)
Pianoman
Declare a Function or a procedure as
MyProc(P1: String; Args: Array of Const);
And as Michael Van Canneyt said, you can use as many parameters. But dont
forget to compile it with -S2 option.
Like C, you must provide some method to distinguish between different data
types within the first parameter itself, and access the rest using:
Args[ParameterNumber].vChar for Char
Args[ParameterNumber].vString for string and
Args[ParameterNumber].vInteger for integer data types.
More information about the fpc-pascal
mailing list