[edited] I got my code working well now. But can someone explain why a is passed to b by b = a and not b = &a ? I thought I had to get b to point to the address to a using &. Thanks.
Code:
#include <iostream>
using namespace std;
void myf(double a[]);
int main()
{
double a[]={1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8};
myf(a);
system("pause");
return 1;
}
void myf(double a[])
{
double * b;
b = a;
cout << "This is a : " << a[0] << " " << a[1] <<" " << a[2] <<" " << a[3] <<" " << a[4] <<" " << a[5] <<" " << a[6] <<" " << a[7] << endl;
cout << "This is b : " << b[0] <<" " << b[1] <<" " << b[2] <<" " << b[3] << " " <<b[4] <<" " << b[5] <<" " << b[6] <<" " << b[7] << endl;
}