NO, that is not valid C, the array size must be fixed at compile time.
Use Malloc or its equivilent, and cast it to whatever you want and treat it
as an array. You will need to use Char ** I think as you want an array of
pointers.
> -----Original Message-----
> From: Phillip Koebbe [SMTP:[EMAIL PROTECTED]]
> Sent: 22 January 2001 15:49
> To: Palm Developer Forum
> Subject: Dynamic Size of array
>
> Is it possible to create an array that on each execution of the method it
> is potentially a different size? For example, let's say I've got a
> database of authors. On my form, I want to have a list box to display all
> of the authors. To use LstSetListChoices, I have to pass it an array. I
> would rather not have a constant define the size of the array because then
> I would have to tell the user "There is a limit of x authors." I want it
> to be unlimited. Here's what I want to do (conceptually):
>
> static void LoadAuthors(void)
> {
>
> // query database to see how many authors there are
> iNumAuthors = DmRecordsInCategory(dbAuthors, dmAllCategories);
>
>
>
> // instantiate the array
> Char* AuthorList[iNumAuthors - 1];
>
> ...
>
> LstSetListChoices(ListPtr, AuthorList, iNumAuthors);
> }
>
> But that doesn't work. Is there a way to accomplish this?
>
> Thanks,
> Phillip
>
>
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/