Mail Archives: djgpp/1999/07/20/04:55:28
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
- Raw text -