title: Printing in ascending order (sorting) from AVL trees
body: <p>I need to define a main function that reads integers and prints them back in ascending order.</p>
  
  <pre><code>    For example, if the input contains
  
         12
         4
         19
         6
  
     the program should output
  
         4
         6
         12
         19
  </code></pre>
  
  <p>I need to use trees to do this however. I'm given the use of two functions <code>insertavl</code>, and <code>deleteavl</code>at my disposal. Their defintions are like so... <a href="http://ideone.com/8dwlU" rel="nofollow">http://ideone.com/8dwlU</a>  basically when deleteavl is called it deletes the node, and rebalances the tree accordingly
  ... If interested thier structures are in: <a href="http://ideone.com/QjlGe" rel="nofollow">http://ideone.com/QjlGe</a>.</p>
  
  <p>I've gotten this so far:</p>
  
  <pre><code>int main (void) {
     int number;
     struct node *t = NULL;
     while (1 == scanf("%d",&amp;number)) {     
            t = insertavl(t, number);              
     }
     while (t != NULL){
        printf("%d\n",t-&gt;data);
        t = deleteavl(t, t-&gt;data);    
     }    
  }
  </code></pre>
  
  <p>But this doesn't print them in ascending order. Any suggestions would be helpful? thanks in advance!</p>