From: calias DOT bbs AT cszone DOT twbbs DOT org (如此這般) Newsgroups: comp.os.msdos.djgpp Subject: Re: pointer & structure Date: 24 Dec 1999 07:40:20 GMT Organization: 程式設計樂園(CSZone) Lines: 41 Message-ID: <3YA7MV$Piv@cszone.twbbs.org> NNTP-Posting-Host: octa2.ee.ntu.edu.tw X-Trace: gemini.ntu.edu.tw 946022428 9446 140.112.17.90 (24 Dec 1999 08:00:28 GMT) X-Complaints-To: postmaster AT news DOT ntu DOT edu DOT tw NNTP-Posting-Date: 24 Dec 1999 08:00:28 GMT X-Filename: n.djgpp/M.946021183.A To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com : 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:"<aRect.left<<" right:"<aRect.right<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: 程式設計樂園 ◆ From: sowhat.m1.ntu.edu.tw -- ※ Origin: 程式設計樂園 ◆ From: sowhat.m1.ntu.edu.tw