Hi i was trying to pass 2d array of integer using single pointer.I came to know that i must typecast array before passing to the function
Can anyone please explain why we need to typecast before pass my code is below?
 #include <stdio.h>
  void print(int *arr, int m, int n)
 {
       int i, j;
       for (i = 0; i < m; i++)
       for (j = 0; j < n; j++)
       printf("%d ", *((arr+i*n) + j));
 }
   int main()
 {
      int arr[][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
      int m = 3, n = 3;
      print((int *)arr, m, n); // here why i need to typecast and pass?
      return 0;
 }
 
     
     
     
    