just cast the array to a pointer to int.
Code:
void read_matrix(int m[][4])
{
int *p = (int*)m, *end =p+16;
while(p != end)
{
scanf("%d", p++);
}
}
the other way is to do this
Code:
void read_matrix(int *m)
{
int *p = m, *end =p+16;
while(p != end)
{
scanf("%d", p++);
}
}
int main()
{
int array[4][4];
read_matrix(*array);
return 0;
}
either way, but the first way is probably better as it blinds the user to how the function works.
the other way of treating it as a 2D array using pointer arithmetic is abit harder so i won't post unless u want to know.