Yes, so how should you go about 'debugging' this?
First, look at the line where you got this error:
cout << p1[i];
Here, you say 'print the ith element of the array p1'. Now lets look at how p1 is declared:
double p1 = *p++;
It's a double!, not an array of doubles.
You should simply discard 'p1' and use 'p' everywhere:
cout << p[i];