Originally Posted by
rcgldr
The parameter could be a reference to a row in a matrix, although it would need a cast to be used this way.
That doesn't make much sense to me though: if you want to set a particular entry in a given row, and you have a reference to a row in the matrix as the parameter, shouldn't the function just set the entry according to the column, and then the caller just pass the required row? A cast seems completely unnecessary, and if it were necessary, then perhaps this approach is a poor approach because it leads to a double complication. Consider:
Code:
#define NROW 2
#define NCOL 3
void foo(int (&x)[NCOL])
{
x[2] = 1;
}
int main()
{
static int m[NROW][NCOL];
foo(m[1]);
return 0;
}