title: candidate function not viable: expects an l-value for 3rd argument
body: <p>Calculate nth power of P (both p and n are positive integer) using a recursive function myPowerFunction(int p, int n, int &amp;currentCallNumber). currentCallNumber is a reference parameter and stores the number of function calls made so far. myPowerFunction returns the nth power of p.</p>
  
  <pre><code>int myPowerFunction(int p, int n, int &amp;z)
  {
      z++;
      if(n==1)return p;
      else if(n==0)return 1;
      else if(n%2==0)return myPowerFunction(p,n/2,z)*myPowerFunction(p,n/2,z);
      else return myPowerFunction(p,n/2,z)*myPowerFunction(p,n/2,z)*p;
  }
  
  int main()
  {
      cout &lt;&lt; myPowerFunction(3,4,1);
  }
  </code></pre>