title: C++ Pointers and Functions with no return - need to recall the output as a pointer
body: <blockquote>
  <p>Write a C++ code that calls the function add_three() that takes three float numbers and add them together, the function should not return anything, and the output variable should be passed as an input to the function. Note: the number of argument is four.</p>
  </blockquote>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void add_three(float, float *);
  
  int main() 
  {
    float s,r;
    float a[3];
    add_three(a[3], &amp;r); //use of undeclared identifier 'a'
  
    cout&lt;&lt; &quot;The sum is &quot; &lt;&lt; s; //use of undeclared identifier 's'
  
    return 0;
  }
  
  void add_three(float a[3], float *s)
  {
    float r = 0;
    
    for(int i=0; i&lt;3; i++)
      {
        cin &gt;&gt; a[i];
        r = r + a[i]; //invalid operands to binary expression ('float *' and 'float')
      }
    *s = &amp;r;
    
  }
  </code></pre>
  <p>Errors:</p>
  <pre><code>assigning to 'float' from incompatible type 'float *'; remove &amp;
    *s = &amp;r;
  </code></pre>
  <p>I am stuck and can't understand what I am doing wrong (BTW, I am a complete novice).</p>