[fpc-pascal] Initializing Arrays?
juergen.hestermann at gmx.de
Thu Dec 25 10:10:50 CET 2008
I've already read that its not built into pascal but how do I get around
If you use AnsiStrings they should be always initialized (as far as I
know). But most other (and all selfdefined) types are not.
If you want to initialize a whole array in one step you can use:
which fills the whole array with zeros.
For the first element it could be
But if you have an array with lots of shortstrings it may be more
efficient to do it as you wrote, because then only one byte per
shortstring (the length byte) is written.
> Also if I am passing a var to a procedure how would use a pointer as
To declare a var parameter you need to do this:
procedure JSMContactAdd(var contact : JSMContact);
Defining a var parameter tells the compiler to use the pointer to the
variable instead of coping it to a temporary (local) variable.
More information about the fpc-pascal