title: Keep track of how many times a recursive function has been called in C++
body: <p>I am trying to work on a program that has a function whose parameter is an vector of string. I want to use recursive on that function but everytime the function is called, I want to change the parameter to say for example </p>
  
  <pre><code>fun(stringArray[i]) 
  </code></pre>
  
  <p>where i is the number of time the function has been called. </p>
  
  <p>So in simpler way something like following. But I need to keep track of how many times the function fun has been executed. </p>
  
  <pre><code>void fun(){
      cout&lt;&lt;hi;
      if(x!=10)
      fun()
  }
  
  int main(){
  
      fun();
  }
  </code></pre>
  
  <p>In this one let's say I want to print it out just 10 times, so want to have a varible that increments, and when reaches 10, it stops. So in general what can I do to keep track of it? I tried using global variables but they don't seem to work with functions. Any suggestions?</p>