I'm trying to write a glue function between two data types and I can't seem to get the compiler to be happy. On one side, I have a pointer to a chunk of data that is logically a n x 2 array, but is declared as:
double* pData=new double[2*n];
On the other side, I have a c function that is declared as
void Function(double data[][2], int n);
If I remember my c syntax, the data[][2] is really just a pointer to a contiguous chunk of memory, but the compiler knows the size of the second dimension is 2. So I'd like to take pData and pass it into Function(), without a memcpy. I just can't seem to write the cast. I thought something like
Function((double [][2])pData,n)
would work, but the compiler (MSVC 8) doesn't like that. Can anyone let me know the proper way to write the cast to get the compiler to be happy.