Hi,
when U assign mylist to temp , free mylist , temp is also
freed and mylist = temp->next wud work awkwardly :-)
this wud be the right way.
while(mylist->next) {
temp = mylist->next;
free (mylist);
mylist = temp;
}
This wud effectively free Ur linked list.
Anyways check this. I may not be completely correct.
Suri
Wipro-NORTEL Lab B'lore
>
>and i make a list with it, how do i free all the ram that the list uses? this
>is the part of lists i could never work out.
>
>node_t *mylist, *temp;
>
>build_a_list (mylist);
>while (mylist) {
> temp = mylist;
> free (mylist);
> mylist = temp->next;
>}
>mylist = NULL;
>
>
>--
>>> I Like England Just Fine, But I Ain't Eating Any Of That Beef <<
><< MailTo: root <at> kermit "dot" globalnet /dot\ co 'dot' uk >>
>>> De Chelonian Mobile <<
>
>
--
cheers,
Suri
Kidding mayam jagath sarvam______ Mera Bhaarath Mahan