title: warning: control reaches end of non-void function. C Binary Search Tree
body: <p>I have an insert function for a Binary Search Tree and i can not find out why i am getting that error. Even if i put a return FALSE; right before the function ends it still happens. Any help is appreciated.</p>
  
  <pre><code>boolean insert(NODE **root, Employee e){
  NODE *cursor,*temp;
  // boolean status;
  
  temp = (NODE *)malloc(sizeof(NODE));
  assert(temp != NULL);
  
  temp-&gt;element = (Employee *)malloc(sizeof(Employee));
  assert(temp -&gt; element != NULL);
  
  *(temp -&gt; element) = e;
  temp -&gt; left = NULL;
  temp -&gt; right = NULL;
  
  if (*root == NULL) {
      *root = temp;
      return TRUE;
  }
  
  // tree is non-empty
  cursor = *root;
  while (cursor != NULL) {
      if(e.ID &lt; cursor -&gt; element -&gt; ID){
          if(cursor -&gt; left == NULL){
             cursor -&gt; left = temp;
             return TRUE;
          }
          else cursor = cursor -&gt; left;
      }
  
      //e goes to the right
      else {
          if (e.ID &gt; cursor -&gt; element -&gt; ID){
             if(cursor -&gt; right == NULL){
                cursor -&gt; right = temp;
                return TRUE;
             }                        
             else
                cursor = cursor -&gt; right;
          }
          else { // e is already in the tree
             free(temp -&gt; element);
             free(temp);
             return FALSE;
          }
      }
     }  // while cursor != NULL
   } // insert
  </code></pre>