This function does not return an array; it returns a single float. You are also accessing out of bounds memory when you assign to it on the 2nd to last line.
If you want to return an array you will have to deal with dynamically allocating and deleting memory yourself. There is more information in the tutorial here on dynamic memory I believe.