title: How to break recursion in Char* function? C Programming
body: <p>I have a ternary tree, every node got id and name.</p>
  <p>How can I return <code>root-&gt;name</code> when <code>root-&gt;id == id</code> and break the recursion?</p>
  <pre class="lang-c prettyprint-override"><code>char *nameWithUsedId(Trin_Ari *root, int idNumber) {
      if (root==NULL)
          return NULL;
      if (root-&gt;id==idNumber)
          return root-&gt;name;
      nameWithUsedId(root-&gt;left,idNumber);
      nameWithUsedId(root-&gt;middle,idNumber);
      nameWithUsedId(root-&gt;right,idNumber);
  }
  </code></pre>