1#include <stdio.h>
2
3//passing 2D array as a parameter to a function
4void fun(int *arr, int m, int n)
5{
6 int i, j;
7 for (i = 0; i < m; i++){
8 for (j = 0; j < n; j++)
9 printf("%d ", *((arr+i*n) + j));
10 printf("\n");
11 }
12}
13
14int main(void)
15{
16 int arr[][4] = {{1, 2, 3,4}, {4, 5, 6,7}, {7, 8, 9,0}};
17 int m = 3, n = 4; //m - no.of rows, n - no.of col
18
19 fun(&arr, m, n);
20 return 0;
21}