title: a way to test if you're on the first run of several recursive calls c++
body: <p>I'm was wondering if there's a way to check if you're on the first recursive call of a series of many recursive calls.</p>
  
  <p>I'm working on a function that tests to see if the input is a palindrome.  After the last recursive call is over, the input string is changed to to the reverse of the original.  Now all I want to do is compare the result with the original.  But when the base case is reached, I no longer have access to the copy of the original string I made in the else statement.  </p>
  
  <p>My thought is then to compare <code>palCopy</code> with <code>palCheck</code> under the else statement but the problem with that is that the program will check this during EVERY recursive call when I only want to check it when control is returned to the original recursive call.  Is there a way to conditionally compare <code>palCopy</code> and <code>palCheck</code> only when control is returned to the original recursive call?</p>
  
  <pre><code>void isAPalindrome(MyString palCheck, int bound1, int bound2)
  {
  
      if (bound1 &gt;= bound2)
      {
          cout &lt;&lt; palCheck;
      }
      else
      {
          MyString palCopy = palCheck;  // make a copy of the original argument so as not to alter it
          char temp = palCopy[bound1];
          palCopy[bound1] = palCopy[bound2];
          palCopy[bound2] = temp;
          isAPalindrome(palCopy, bound1 + 1, bound2 - 1); 
      }
  </code></pre>