I'm a python programmer writing some c (wrapped in ctypes) to speed up some tight loops. I'm having trouble with a function that takes a two dimensional array (*double)[2], does some things to it and returns it. Function looks something like the following:
double *process(int n, double (*results)[2], ...) {
// Do some things to results
return results;
}
Here, n is the number of elements in the first level of results. This doesn't compile, apparently I'm returning from an incompatible pointer type. Making it return *results allows it to compile and run (all the contained logic is fine), but segfaults at the return. Making the function a double ** and returning with any number of *s doesn't let me compile.
Clearly I'm being an idiot here, which isn't surprising at all as I don't really understand c pointers. What do I need to do to make this work? I've got another function that returns a double * working fine, so it's clearly something to do with the 2D array.