You want to return a pointer to an array but you have declared extend() to return a double. That doesn't work.

Your results are stored in "amount" after calling the function, thus the easiest...