Originally Posted by
kira_coder
so here you free LISTdt which is on the stack or do you allocate ListDt and allocate after that the linked list ? if not then thats your problem and it would lead to other problem on noticed one in deleteDList in which ur deleting all including head.
This is were I create my list
Code:
ListDT *createDList()
// returns a pointer to the header cell of the created list
{
ListDT *List=(ListDT*) malloc( sizeof (ListDT) );
if (List != NULL)
{
List->size=0;
List->first = NULL;
List->last = NULL;
}
return List;
}
My main.c has only this:
Code:
ListDT *L=NULL;
L=createDList()
destroyDList(L);
printDList(L);
I'm just trying to find out how this works.
It runs at infinity, printing a large number over and over again (eg. 7864235) (an adress I think)