Say I have a multi-dimensional matrix in C, matrix[2][3]
, whose elements look like this:
1 3 5
2 3 4
I would like to pass the second row of the matrix (as an array) to a function. I do it this way:
void myFunction(int array[]) {
}
int main() {
int matrix[2][3];
myFunction(matrix[2]);
}
Though, when I print the values of the array[]
inside myFunction
the elements look all set to zero:
0 0 0
How do I pass the elements of row of a matrix to a function properly?