title: How to avoid stack overflow of a recursive function?
body: <p>For example if we are traversaling a rather big tree by following function, it is possible that we get stack overflow.</p>
  
  <pre><code>void inorder(node* n)
  {
    if(n == null) return;
    inorder(n-&gt;l);
    n-&gt;print();
    inorder(n-&gt;r); 
  }
  </code></pre>
  
  <p>How to add a condition or something into the function to prevent such overflow from happening?</p>