W
Why Tea
Suppose you have a 2-dimensional array (matrix) in main() and you want
to pass it to a function to do some processing, you usually pass it as
a pointer to the first element. But, from the function, how do you use
the index notation?
Example:
int matrix_check(int *m)
{
/* how can we use m[j] type of representation? */
}
int main()
{
int mat[10][10];
if (matrix_check(&matrix[0][0]))
{
/* do something */
}
...
}
to pass it to a function to do some processing, you usually pass it as
a pointer to the first element. But, from the function, how do you use
the index notation?
Example:
int matrix_check(int *m)
{
/* how can we use m[j] type of representation? */
}
int main()
{
int mat[10][10];
if (matrix_check(&matrix[0][0]))
{
/* do something */
}
...
}