Hi,
I am trying to assign an array of pointer the values of a pointer to pointer, but canīt get it right.
This is what I have :
float **vars_array coming from the function arguments of size 3 x nnodes. Also nnodes comes as argument of the function.
This is what I have now and is working properly:
Code:
void wrt2VTK_unstr(float **vars_array, int nnodes)
{
unsigned int i;
float vars1[nnodes], vars2[nnodes], vars3[nnodes];
//LOOP VARS:
for(i = 0; i<nnodes; i++){
vars1[i] = vars_array[i+1][0];
vars2[i] = vars_array[i+1][1];
vars3[i] = vars_array[i+1][2];
}
//vars[]
float *vars[] = {vars1, vars2, vars3};
return 0;
}
but what I need to do is, INSTEAD of assigning *vars[] with the arrays vars1, vars2, and vars3, I want to assign *vars[] directly with vars_array[1:nnodes][0], vars_array[1:nnodes][1], vars_array[1:nnodes][2].
How can I pass these "2D" pointers to *vars[] ?
thank you in advance,
Best
cfd