Mail Archives: djgpp/1999/12/24/13:57:19
: Without looking to much further, You are assignement does not look right
: unless, you meant
: LINEPtr *clp, *FirstPtr;
: ^^^
ya~I mean it..
Here is a example I've write that can run well...
ListElement *aLE;
ListElement *FIrstLE=aLE;
for (int i=0;i<10;i++)
for( int j=0;j<10;j++){
aLE->next=new ListElement;
aLE=aLE->next;
aLE->aRect.left=i;aLE->aRect.right=j;
}
//then connect it
aLE->next=FirstLE->next;
//read data
do {
aLE=aLE->next;
cout <<"left:"<<aLE->aRect.left<<" right:"<<aLE->aRect.right<<endl;
}while(aLE->next!=FirstLE->next);
//free the memory
do {
aLE=aLE->next;
delete aLE;
}while(aLE->next!=FirstLE->next);
//here it can free well that while i delete aLE
//the aLE->next will not become something else...
--
¡° Origin: µ{¦¡³]p¼Ö¶é ¡» From: sowhat.m1.ntu.edu.tw
--
¡° Origin: µ{¦¡³]p¼Ö¶é ¡» From: sowhat.m1.ntu.edu.tw
- Raw text -