home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / database / avltree / avlfree.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-09  |  468 b   |  26 lines

  1. #include <stdio.h>
  2. #include "avl.h"
  3.  
  4. static   void  fa(root)
  5. HEADER   *root;
  6. {
  7.    /* Delete the entire tree pointed to by root.  Note that unlike
  8.     * tfree(), this routine is passed a pointer to a HEADER rather
  9.     * than to the memory just below the header.
  10.    */
  11.  
  12.    if(root)
  13.       {
  14.       fa( root->left  );
  15.       fa( root->right );
  16.       free(root);
  17.       }
  18. }
  19.  
  20. void     freeall(root)
  21. HEADER   **root;
  22. {
  23.    fa(*root);
  24.    *root = NULL;
  25. }
  26.