I am designing a C function interface which involves a 2d array. The problem is, row dimension is constant, and column one should be user defined.
#define ROWS (65)
void init(int columns, float array[ROWS?][columns?])
{
...
}
void main()
{
float array1[ROWS][30];
float array2[ROWS][50];
init(30, array1);
init(50, array2);
}
How do I design an interface to be able to pass this kind of array down to function?
p.s.
Can't do it the other way around, where columns would be constant, because must use some 3rd pary libraries that want it this way.
void init(int columns, float array[ROWS][columns]).#define ROWS (65)is fine, although the parentheses are redundant if the macro is just being used as a constant.