delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/24/13:32:18

From: Moo-Juice <Ben AT flag DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Dynamic Arrays
Date: Fri, 24 Jan 1997 10:50:36 +0000
Organization: Honest Ron's Car Emporium
Lines: 17
Distribution: world
Message-ID: <QVUYf$A8PJ6yEwT5@flag.demon.co.uk>
References: <01bc072e$33eb9b20$ee038cd0 AT wahander> <32E453A2 DOT FA3 AT cs DOT com>
NNTP-Posting-Host: flag.demon.co.uk
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <32E453A2 DOT FA3 AT cs DOT com>, "John M. Aldrich" <fighteer AT cs DOT com>
writes
>Josh Anderson wrote:
>> 
>> I know this is a stupid question, but how do you create a dynamic array of
>> a bunch of structs? I only need to set the size of the array at init time.
>> And then free the memory at exit.

>If you want to make the entire list dynamic, i.e.; its size can change
>during runtime, then you need a much more complex algorithm, but again
>it's something that's in every C textbook I've ever seen.  If you really
>still need help, email me in private and I'll send you more samples.

Surely simply using a realloc will suffice?

-- 
Moo-Juice

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019