Maybe you can let the function pass back the next k.
for( k = list; k; k = k_next )
{
 k_next = multiple_remove( k );
}
Something in those lines might work.

Htam
----- Original Message ----- 
From: "Jason Gauthier" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: 2003.10.21 06:42
Subject: Removing linked lists items.


> Greetings.
>
>  Seems like a dumb question, but it's not what you would think.
>
> I am trying to remove items from a linked list.  Normally, this is not a
> problem for me.
>
> for (k=list; k!=NULL; k=k_next) {
>   k_next = k->next;
>
>    /* code code code */
> }
>
> Is fine for removing one entry.  However, I have a function that might
cause
> several items in the list to be removed, including what k_next is pointing
> at.  This makes k_next start looping through the k_free linked list.
> Definitely not what I want.
>
> Any suggestions?
>
> Jason
>
> -- 
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom


Reply via email to