double OutputArray[length];
In C++, you cannot create an array of variable size like this. length must be known at compile time.
There is another problem with your code as well; anything you create inside a function on the stack (which is anything you create that you didn't create using new) ceases to exist when the function ends. You are returning a pointer to an array that ceases to exist when the function ends. All that array will be recycled and the memory space used for something else.