Complete.Org: Mailing Lists: Archives: discussion: February 2000:
[aclug-L] Re: Simple C question (which shows my C ignorance)
Home

[aclug-L] Re: Simple C question (which shows my C ignorance)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: aclug-L@xxxxxxxxxxxx
Subject: [aclug-L] Re: Simple C question (which shows my C ignorance)
From: John Reinke <jmreinke@xxxxxxxxx>
Date: Thu, 3 Feb 2000 01:21:19 -0600
Reply-to: aclug-L@xxxxxxxxxxxx

I'm not sure I follow what you are doing, but if you used malloc to declare
the array, and want to shorten the array by one, shift everything down, and
do a realloc reflecting the new size of the array.

(I assume you didn't need this help for a programming class.  ;-)

John

>I need to delete a member of an array of structure pointers and have the
>new situation reflected minus the one removed. Can I just do
>free(array1[i]), then decrement the index counter, or do I need to shift
>everything down? The members were allocated with malloc, and I'm lost.
>Any ideas?
>
>--
>Larry Bottorff  /  mrprenzl@xxxxxxxxxx  /  316.345.3387




[Prev in Thread] Current Thread [Next in Thread]