Hi all,

I'm having a bit of difficulty figuring out how to allocate memory for a 
structure that contains an array of structures.

I found some sample code on how to allocate memory for such a setup, as follows:

pdat = (struct pdata *) MemPtrNew(sizeof(struct pdata));
pdat->idat = (struct idata *)MemPtrNew(5 * sizeof(struct idata));

This code will allocate a structure called pdat as well as allocate memory for 
an array of five idat structures within the pdat structure.

How would I go about allocating memory for this structure if I didn't know 
beforehand the number of idat structures will exist in the array?  Or is this 
information absolutely required in order to do this?

Thanks.
-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to