title: Recursive function that computes sum of n integers C++
body: <p>I have to make a recursive function that will compute the sum of the first n integer in an array of at least n integers. I believe I have the function complete the cout statement however is causing an error. Any help would be appreciated.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int n = 0;
  int array[];
  
  int sum(int array[], int n);
  
  int main()
  {
      cout &lt;&lt; sum(array, 4)&lt;&lt; endl;
      return 0;
  }//end main
  
  int sum(int array[], int n)
  {
      if(n &lt;= 0) 
      {
          return 0;
      }
  
      else
      {
          return array[0] + sum(array + 1, n-1);
      }
  }// end Compute
  </code></pre>
  
  <p>Here is the error:</p>
  
  <blockquote>
    <p>fatal error LNK1120: 1 unresolved externals</p>
  </blockquote>