home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
s
/
sep91.zip
/
9N09024B
< prev
next >
Wrap
Text File
|
1991-07-12
|
612b
|
29 lines
/* --------------------------------------------------------------
FUNCTION GET_FREE_NODE: The steps to get a node from the free node list
are:
A. If the free node list is empty, get memory for a new node and
return its address.
B. Else remove the first node from the free list and use that.
-------------------------------------------------------------- */
Node *get_free_node(void)
{
Node *pnew_node;
/*A*/ if (pfree_node == NULL) {
pnew_node = malloc(sizeof(Node));
}
/*B*/ else {
pnew_node = pfree_node;
pfree_node = pfree_node->pfwd;
}
return pnew_node;
}