title: c++ debugging a recursive function and it doesn't exit the function right away
body: <p>If I put a break point on this function it will step through until the base case is met but when it hits the return 1 it doesn't actually exit the loop. Instead it goes to the bottom bracket and then bounces to int t = expo(m, n / 2) and steps downs to return t * t*m. It then goes back to the bottom bracket and repeats this process before eventually stopping. Can someone explain what is going on?</p>
  
  <pre><code>int expo(const int m, const unsigned int n) {
  
      funcCallCounter++;  //counts how many times the function is called
  
      if (n == 0) {
          return 1;
      }
      else {
          if (n % 2 == 0) {
              int t = expo(m, n / 2);
              return t * t;
          }
          else {
              int t = expo(m, n / 2);
              return t * t*m;
          }
      }
  
  
  }
  </code></pre>