From: "DeHackEd" References: <352EDA1E DOT 7B0C55AF AT teccart DOT qc DOT ca> Subject: Re: Dynamic memory allocation Date: Sun, 12 Apr 1998 09:50:41 -0400 Lines: 29 Message-ID: Newsgroups: comp.os.msdos.djgpp To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk You have 4 options: 1) Just don't let the user put in more than 10 2) Remove unused objects from the list if it gets to big 3) Use a linked list as already mentioned. 4) Malloc, realloc, free. C++ doesn't have a realloc equivalant (oh no...) to new and delete. Use C routines instead. Object **objects; objects = malloc(sizeof(Object*) * objectsneeded); for (int i = 0; i < objectsneeded;i++) objects[i] = new Object; // If you need more, realloc it. objects = realloc(objects, sizeof(Object*)*newobjectsneeded); You will need to do some casting to get rid of C++ warnings, but I left them out so you can read this. -- "DeHackEd" EMail address not given out due to low-life spammers.