hi

i'm currently using a dynamically resized array to store a list of structs.
its working nicely, what i want to know is this:

are there any things i should be careful for, when using a pointer to an
array?  it seems much easier to me to use an array that i resize dynamically,
than use a linked list (i.e. sorting).  and what is the best way to delete 
an item in the array that is, say, in the middle.  

here are the pertinent declarations:

#define GROW_BY 5

int ListCount = 0;
int ListSize = GROW_BY;
pwlistentry (*PasswordList)[GROW_BY] = NULL;

then, when i add entries, i check to see if ListCount+1 > ListSize, if
so, i call realloc() to resize the array (PasswordList), and make it
GROW_BY entries bigger, then i add the entry into the array.

anything wrong with this approach?

tia,

leon

-- 
 Leon Breedt  |  Codewarrior :) |  Debian 2.0  |  Linux 2.1.127
 PGP key and homepage at http://ejb.www.icon.co.za

 Linux:  Because I want to get there *today*

Reply via email to