AllocateStructure()
Syntax
*Item.StructureName = AllocateStructure(StructureName)Description
Allocates a new dynamic structure item. This dynamic structure item is properly initialized and ready to use. To access the structure data, a pointer associated with the specified 'StructureName' has to be used.
Parameters
StructureName The name of the structure used to create the new dynamic item. The structure has to be already created.
Return value
The address of the new dynamic structure item, zero otherwise.
Remarks
This command is for advanced users and shouldn't be needed for most of programs. It's often a better choice to use a structured array, list or map to store dynamic structured items.
FreeStructure() can be used to free the dynamic structure item. All dynamic structures are automatically freed when the programs ends.
Example
Structure People Name$ List Friends$() EndStructure *DynamicPeople.People = AllocateStructure(People) *DynamicPeople\Name$ = "Fred" AddElement(*DynamicPeople\Friends$()) *DynamicPeople\Friends$() = "Stef" Debug *DynamicPeople\Name$ Debug *DynamicPeople\Friends$() FreeStructure(*DynamicPeople)
See Also
FreeStructure()
Supported OS
All