Hello all, I am needing to calculate the amounts of the values stored in the arrays within a function. The calculations within the function however have to be done using pointers. I am having trouble figuring out how to return the value calculated and display it within main. This is what I have so far, any help would be great.

Code:

#include <stdio.h>
double extend (double [], double [], double []);
int main ()
{
#define max 10
double price [max] = {10.62, 14.89, 13.21, 16.55, 19.62, 9.47, 6.58, 19.32, 12.15, 3.99};
double quantity [max] = {4, 9.5,6, 7.35, 9, 15.3, 3, 5.4, 2.9, 4.9};
double amount [max];
int i;
for (i=0; i<max; i++){
printf ("The amount is %f\n", extend(price, quantity, amount));
}
system ("PAUSE");
return 0;
}
double extend (double price[], double quantity[], double amount [])
{
int i;
double *gPtr, *mPtr, *nPtr;
gPtr= price;
mPtr= quantity;
nPtr= amount;
for (i=0; i<max; i++){
*nPtr++= *mPtr++ * *gPtr++;
}
return (amount);
}