title: Recursive does not listen to Return but Exit(0)
body: <p>** Edit , Apologies, I just learnt that this is recursive. Apologies. </p>
  
  <p>**Any advice on how i can make it work like a loop where I can return as **and when i want? or is my design very wrong? </p>
  
  <p>I have the following loop that i Call, I personally want to call Next function and pass the previous "root" into the Tree </p>
  
  <p>Problem i face now is when i return, it's being ignored but if i replace my return with exit(0); it stops, It just doesn't stop when i do a return.</p>
  
  <p>By right if i'm right, return should stop the loop and directly return to the function that called it so that I can call NEXT when i want to. </p>
  
  <p>Conclusion : As long as it hits return, the loop will repeat itself until the end of the Tree.</p>
  
  <p>Objective : Loop next only when i call this function. I will return the current position of the node and put it back when i want the Next.</p>
  
  <p>Any Advice? </p>
  
  <pre><code>struct item* loop(struct item *root)
  {
  
     if(root != NULL){
        if(root-&gt;right != NULL) {
            loop(root-&gt;right);
            printf("%s\n", root-&gt;basket);
            exit(0); // It would respond to Exit and stop the looping of tree
            return root;
  
        }
        if(root-&gt;left != NULL) {
            loop(root-&gt;left);
            printf("%s\n", root-&gt;basket);
            return root; // This would be ignored
            exit(0); // This doesn't help too
        }
  
      }
  
  }
  </code></pre>
  
  <p>I used Exit() for debugging because it does what i want but i cant use it because i wont get the result i want </p>