ub3r_n00b
06-05-08, 02:08 PM
Hey guys, I am getting a segmentation fault using this macro (this is in C++):
// A parametric macro to allow the use of dynamic multi-dimensional arrays
#define arr(arr,x,y,z,dim) *(arr + (z + dim[2]*(y + dim[1]*(x))))
I am trying to convert this to a function
double arr(double* arr, int x, int y, int z, double* dim)
{
return *(arr + (z + dim[2]*(y + dim[1]*(x))));
}
Would this do the same thing?
// A parametric macro to allow the use of dynamic multi-dimensional arrays
#define arr(arr,x,y,z,dim) *(arr + (z + dim[2]*(y + dim[1]*(x))))
I am trying to convert this to a function
double arr(double* arr, int x, int y, int z, double* dim)
{
return *(arr + (z + dim[2]*(y + dim[1]*(x))));
}
Would this do the same thing?