Store reference / pointer of an array

To add comments, please log in or register
Henrique Vilela
1971
Henrique Vilela  

I can receive an array as reference, but can I store it?

double *a[]; // '*' - pointer cannot be used
double &b[]; // '&' - reference cannot used
double c[];

void X(double &d[])
  {
   a=d;
   b=d;
   c=d; // 'c' - invalid array access
  }
Alain Verleyen
36131
Alain Verleyen  
Henrique Vilela:

I can receive an array as reference, but can I store it?

Only this way as far as I know :

double c[];

void X(double &d[])
  {
   ArrayCopy(c,d);
  }
Henrique Vilela
1971
Henrique Vilela  
Alain Verleyen:

Only this way as far as I know :


But like this you have a copy. If one is changed the other keep the old value. It's not what I´m looking for.

Alain Verleyen
36131
Alain Verleyen  
Henrique Vilela:

But like this you have a copy. If one is changed the other keep the old value. It's not what I´m looking for.

You need to use a structure or a class. It was implied in previous post.

To add comments, please log in or register