www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/24/13:57:19

From: calias DOT bbs AT cszone DOT twbbs DOT org (¦p¦¹³o¯ë)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: pointer & structure
Date: 24 Dec 1999 07:40:20 GMT
Organization: µ{¦¡³]­p¼Ö¶é(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:"<<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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019