Hello this is my first post, so... please help me.
I want to create a function that prints the content of a matrix(2d array).
I know that in order to set a matrix as a argumentin a function I have to do it like this
(example)
or something like that... but in this case I am supposed to know the value of N.Code:void printMatrix(matrix[][N], size){ int i,j; for(i=0;i<size;i++) for(j=0;j<N;j++) printf("matrix[%d][%d]",i,j); }
and that is my problem. Because i don't know the value of N
I want to create a function that can work on any size of matrix
a friend told me that :
would work fine.... and actually when compiling there is no problem in the declaration, but the problem is in the calling line.Code:void printMatrix( *matrix[], size){ int i,j; for(i=0;i<size;i++) for(j=0;j<size;j++) printf("matrix[%d][%d]",i,j); }
How should i call this function?
(i was calling it
printMatrix(someMatrix,6)
but it doenst work fine)
help.



LinkBack URL
About LinkBacks


