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: Jeff <schaller@xxxxxxxxxxxxx>
Date: Thu, 3 Feb 2000 06:57:40 -0600 (CST)
Reply-to: aclug-L@xxxxxxxxxxxx

On Thu, 3 Feb 2000, Larry Bottorff wrote:

Let me simplify things, make sure I understand what's going on:

> I do a malloc for each member of the array (of stuctures):
> array1[count] = ... as I need it after declaring
> array1[NUM] beforehand. Then I need to remove a given member of array1.

> If I shift everything down, how do I use realloc?

skip the realloc and just use a for() loop. Loop from the one you
want deleted until NUM-1; assign [i] = [i+1]. Decrement NUM by 1.

-jeff
-- 
ed is the standard text editor. http://www.gnu.org/fun/jokes/ed.msg.html


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