title: sum even numbers in BST
body: <p>In this code, I need create a function which will sum even numbers in my BST.  I don't know how to pass all nodes of my tree.  Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  struct node
  {
      int key;
      struct node *left, *right;
  };
  
  struct node *newNode(int item) {
  struct node *temp=(struct node *)malloc(sizeof(struct node));
      temp-&gt;key = item;
      temp-&gt;left = temp-&gt;right = NULL;
      return temp;
  }
  
  struct node* insert(struct node* node, int key) {
      if (node == NULL) return newNode(key);
      if (key &lt; node-&gt;key)
          node-&gt;left = insert(node-&gt;left, key);
      else
          node-&gt;right = insert(node-&gt;right, key);
      return node;
  }
  
  void main(void)
  {
      struct node *root = NULL;
      int data[]={3,1,2,6,4,7,8}, n, i;
      n=sizeof(data)/sizeof(data[0]);
      for(i=0;i&lt;n;i++)
          root=insert(root,data[i]);
  }
  </code></pre>