From: Edward Hill Newsgroups: comp.os.msdos.djgpp Subject: Re: A Structured Problem ? Date: Tue, 20 Jul 1999 09:18:07 +0100 Organization: GEC-Marconi Lines: 36 Message-ID: <379430BF.4B633E7D@nochance.com> References: <7mv0te$gq2$1 AT news6 DOT svr DOT pol DOT co DOT uk> <7n09p0$9db$1 AT news5 DOT svr DOT pol DOT co DOT uk> NNTP-Posting-Host: pc02372.gmsws.gecm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.51 [en] (Win95; I) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Paul J G wrote: : : Many thanks to everybody, everythings running fine now. Although perhaps you : could be so kind as to answer these questions for me. : : 1) How would I use the free command to free up one of the shape indentifiers : or to delete : the whole structure ?. You shaould call free once for every item malloc'ed. So, void freemyshape(int shapeno) { if(shape[shapeno].xpoint != NULL) free(shape[shapeno].xpoint); if(shape[shapeno].ypoint != NULL) free(shape[shapeno].ypoint); } assuming is global otherwise you'll have to pass the shape to the function. : 2) Both Michael and Ed used slightly different malloc commands, whats the : difference ?. Michael was casting the return of malloc, which is a bad idea in C I assume he was writing in C++. : 3) If I am writing for a machine with 32 megs and want to use, say 3 megs : for holding my shape data in would I use FARMALLOC command instead ?. no malloc should suit you fine. DJGPP is good like that. Ed