aboutsummaryrefslogtreecommitdiffstats
path: root/test/ccured_olden/treeadd/par-alloc.c
blob: 4749e19598a27f520d3430c817a62522ab8cc4ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* For copyright information, see olden_v1.0/COPYRIGHT */

/* tree-alloc.c
 */

#ifdef SS_PLAIN
#include "ssplain.h"
#endif SS_PLAIN

#include "tree.h"


tree_t *TreeAlloc (level)
    int		level;
{

  if (level == 0)
    {
      return NULL;
    }
  else 
    {
      struct tree *new, *right, *left;
      
      new = (struct tree *) mymalloc(sizeof(tree_t));
      left = TreeAlloc(level-1);
      right=TreeAlloc(level-1);
      new->val = 1;
      new->left = (struct tree *) left;
      new->right = (struct tree *) right;
      return new;
    }
}