prototyping (oh no! not again??)
Michael Salmon
epames at eos.ericsson.se
Thu Nov 29 22:43:11 AEST 1990
In article <DAVIS.90Nov26144044 at pacific.mps.ohio-state.edu> John E. Davis writes:
> I have a function that takes a 2-d array of unknown dimension and does
> things with it. How do I declare and call it?
>
You could try this approach, I haven't tried it but I'm pretty sure
that it will work. I have used 4x4 because I hate typing but the idea
is of course extensible both in the size and number of dimensions.
double actual[4][4];
double *matrix[4] = {
actual[0],
actual[1],
actual[2],
actual[3]
}
Your call to trace will now be correct and you should be able to
access matrix[i][j] as you are used to. The major disadvantage as
far as I can see is that matrix must be external or static to allow
initialization or you will have to initialize it manually. Hope
that this is some help.
Michael Salmon
L.M.Ericsson
Stockholm
More information about the Comp.lang.c
mailing list