fork(1) download
  1. #include <stdio.h>
  2.  
  3. void my_func(int **arr, int cols)
  4. {
  5. int (*matrix)[cols] = arr;
  6. printf("test2: %d\n", matrix[0][1]);
  7. }
  8.  
  9. int main(void)
  10. {
  11. const int row = 3;
  12. const int col = 4;
  13.  
  14. int arr[3][4] = {
  15. {1,2,3,4},
  16. {3,4,5,6},
  17. {5,6,7,8}
  18. };
  19. printf("test1: %d\n", arr[0][1]);
  20.  
  21. my_func(arr, col);
  22. }
Success #stdin #stdout 0s 4332KB
stdin
Standard input is empty
stdout
test1: 2
test2: 2