title: Function Returning an array in Fortran
body: <p>It is my understanding that you can return an array from a function in Fortran, but for some reason my code is only returning the first value in the array I am asking it to return. This is the function:</p>
  
  <pre><code>function polynomialMult(npts,x,y)
      integer npts
      double precision x(npts), results(npts + 1), y(npts,npts)
  
      polynomialMult =  x(1:npts) + 1
  
  end function
  </code></pre>
  
  <p>and this is where I'm calling it </p>
  
  <pre><code> C(1:numPoints) = polynomialMult(numPoints,x,f)
  
  print *, C(1:numPoints)`
  </code></pre>
  
  <p>right now it doesn't do anything useful because I am trying to understand the syntax before I write the logic. I saw some stuff about specifying types for functions, but when I write </p>
  
  <pre><code>integer function polynomialMult(npts,x,y)
  </code></pre>
  
  <p>or whatever I get a compilation error.</p>