fork download
  1. int main() {
  2. int i, arr[m][n], j, m, n;
  3. int max = 0;
  4. int *ptr;
  5.  
  6. printf("enter the value m");
  7. scanf("%d", m);
  8. printf("enter the vaue of n");
  9. scanf("%d", n);
  10. ptr = (int*) malloc(m * n * 4);
  11. printf("enter the values\n");
  12.  
  13. for (i = 0; i < m; i++)
  14. {
  15. for (j = 0; j < n; j++)
  16. {
  17. scanf("%d", ((ptr + i * n) + j));
  18. }
  19. }
  20.  
  21. max = arr[0][0];
  22. for (i = 0; i < m; i++)
  23. {
  24. for (j = 0; j < n; j++)
  25. {
  26. if (max < *((ptr + i * n) + j));
  27. max = *((ptr + i * n) + j);
  28. }
  29. }
  30. printf("%d", max);
  31. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:2:14: error: ‘m’ undeclared (first use in this function)
   int i, arr[m][n], j, m, n;
              ^
prog.c:2:14: note: each undeclared identifier is reported only once for each function it appears in
prog.c:2:17: error: ‘n’ undeclared (first use in this function)
   int i, arr[m][n], j, m, n;
                 ^
prog.c:6:3: error: implicit declaration of function ‘printf’ [-Werror=implicit-function-declaration]
   printf("enter the value m");
   ^~~~~~
prog.c:6:3: error: incompatible implicit declaration of built-in function ‘printf’ [-Werror]
prog.c:6:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
prog.c:7:3: error: implicit declaration of function ‘scanf’ [-Werror=implicit-function-declaration]
   scanf("%d", m);
   ^~~~~
prog.c:7:3: error: incompatible implicit declaration of built-in function ‘scanf’ [-Werror]
prog.c:7:3: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
prog.c:7:11: error: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘int’ [-Werror=format=]
   scanf("%d", m);
           ^
prog.c:9:11: error: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘int’ [-Werror=format=]
   scanf("%d", n);
           ^
prog.c:10:16: error: implicit declaration of function ‘malloc’ [-Werror=implicit-function-declaration]
   ptr = (int*) malloc(m * n * 4);
                ^~~~~~
prog.c:10:16: error: incompatible implicit declaration of built-in function ‘malloc’ [-Werror]
prog.c:10:16: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
prog.c:2:10: error: unused variable ‘arr’ [-Werror=unused-variable]
   int i, arr[m][n], j, m, n;
          ^~~
cc1: all warnings being treated as errors
stdout
Standard output is empty