Can a function's argument be used in a later argument? Is this bad form?
void print(int n, int m, int matrix[n][m])
{
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++) {
printf("%i ", matrix[i][j]);
}
printf("\n");
}
}
int main (void)
{
int matrix[2][2] = {{1,3},{3, 5}};
print(2, 2, matrix);
}
In playing around with passing 2-D arrays to functions, I've found a bit of a trick which I'm not sure I trust. It compiles (gcc -Wall -std=c99) and runs, so is there any issue with it?
Furthermore, does this imply that the arguments are read and assigned sequentially from left to right?