title: Insertion function into AVL tree won't insert
body: <p>I am working on an avl tree with strings as keys. The print statements indicate that the insert is happening but in the testing function it reports that the left and right nodes of the root remain null.</p>
  
  <p>Here is my avl tree code:</p>
  
  <pre><code>#include "AVLAdt.h"
  
  void printVal(node * toPrint){
      printf("\n node value: %s\n", toPrint-&gt;nodeValue);
  }
  
  node * search(node * root, char * searchVal){
      if(isExternal(root) == 1) return NULL;
      if(strcmp(searchVal,root-&gt;nodeValue)&lt;0){
          return(search(root-&gt;leftNode,searchVal));
      }
      else if(strcmp(searchVal,root-&gt;nodeValue)==0){
          return(root);
      }
      else {
          return(search(root-&gt;rightNode,searchVal));
      }
  }
  
  
  
  /*initialize a node*/   
  node * initNode(char * toAdd){
      node * newNode = malloc(sizeof(node));
      strcpy(newNode-&gt;nodeValue, toAdd);
      newNode-&gt;leftNode = NULL;
      newNode-&gt;rightNode = NULL;
      newNode-&gt;height = 1;
      return newNode;
  }
  
  
  
  /*function to insert a new node into tree and rebalance if necessary*/
  node * insert(node * root, char * newValue){
  
  
      if(root == NULL){
          printf("\n Inserting %s. \n", newValue);
          return(initNode(newValue));
  
      }
      else{
  
          if(strcmp(newValue,root-&gt;nodeValue)&lt;0){
              printf("go left");
              insert(root-&gt;leftNode, newValue);
          }
          else if(strcmp(newValue,root-&gt;nodeValue)&gt;0){
              printf("go to right node of %s", root-&gt;nodeValue);
              insert(root-&gt;rightNode, newValue);
          }
          else{
              root-&gt;count++;
              return (root);
          }
      }
  </code></pre>
  
  <p>Testing program:</p>
  
  <pre><code>#include "AVLAdt.h"
  
  int main(){
  
  
      node * root = NULL;
  
      char * testString = malloc(sizeof(char)*50);
      strcpy(testString, "aa");
  
      char * testString1 = malloc(sizeof(char)*50);
      strcpy(testString1, "bb");
  
  
      printf("does it try to insert?");
  
      root = insert(root, testString);
      root = insert(root, testString1);
  
      printVal(root);
  
      if(getRight(root) == NULL) printf("right is null");
      else{
  
          printf("right is");
          printVal(getRight(root));
      }
  
      if(getLeft(root) == NULL) printf("left is null");
      else{
  
          printf("left is");
          printVal(getRight(root));
      }
  
  
  
      return(0);
  }
  </code></pre>
  
  <p>The code returns that both left and right nodes of "aa" are null. Why is this?</p>