fork download
  1. void print_matrix(int** array, int n, int m)
  2. {
  3. int n = sizeof(array) / sizeof(array[0]);
  4. int m = sizeof(array[0]) / sizeof(array[0][0]);
  5. int *final = array[0] + n * m - 1;
  6. printf("n=%d\tm=%d\tfinal=%d\n", n, m, *final);
  7.  
  8. for (int *ptr = array[0], i = 1; ptr <= final; ptr++, i++)
  9. {
  10. printf("%d\t", *ptr);
  11. if (i % m == 0)
  12. {
  13. printf("\n");
  14. }
  15. }
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘print_matrix’:
prog.c:3:9: error: ‘n’ redeclared as different kind of symbol
     int n = sizeof(array) / sizeof(array[0]);
         ^
prog.c:1:36: note: previous definition of ‘n’ was here
 void print_matrix(int** array, int n, int m)
                                ~~~~^
prog.c:3:27: warning: division ‘sizeof (int **) / sizeof (int *)’ does not compute the number of array elements [-Wsizeof-pointer-div]
     int n = sizeof(array) / sizeof(array[0]);
                           ^
prog.c:1:25: note: first ‘sizeof’ operand was declared here
 void print_matrix(int** array, int n, int m)
                   ~~~~~~^~~~~
prog.c:4:9: error: ‘m’ redeclared as different kind of symbol
     int m = sizeof(array[0]) / sizeof(array[0][0]);
         ^
prog.c:1:43: note: previous definition of ‘m’ was here
 void print_matrix(int** array, int n, int m)
                                       ~~~~^
prog.c:4:30: warning: division ‘sizeof (int *) / sizeof (int)’ does not compute the number of array elements [-Wsizeof-pointer-div]
     int m = sizeof(array[0]) / sizeof(array[0][0]);
                              ^
prog.c:6:5: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
     printf("n=%d\tm=%d\tfinal=%d\n", n, m, *final);
     ^~~~~~
prog.c:6:5: warning: incompatible implicit declaration of built-in function ‘printf’
prog.c:6:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
prog.c:1:1:
+#include <stdio.h>
 void print_matrix(int** array, int n, int m)
prog.c:6:5:
     printf("n=%d\tm=%d\tfinal=%d\n", n, m, *final);
     ^~~~~~
stdout
Standard output is empty