fork download
  1. #ifndef FUNCTION10_H_
  2. #define FUNCTION10_H_
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. void calc_bombs(int n, int m, bool **is_bomb, int **count);
  8.  
  9. int main() {
  10. int n, m;
  11. scanf("%d%d", &n, &m);
  12. int *count[n];
  13. bool *is_bomb[n];
  14. for (int i = 0; i < n; i++) {
  15. is_bomb[i] = (bool*) malloc(sizeof(bool)*m);
  16. count[i] = (int*) malloc(sizeof(int)*m);
  17. for (int j = 0; j < m; j++) {
  18. scanf("%d", &is_bomb[i][j]);
  19. }
  20. }
  21.  
  22. calc_bombs(n, m, is_bomb, count);
  23.  
  24. for (int i = 0; i < n; i++) {
  25. for (int j = 0; j < m; j++) {
  26. printf("%d%c", count[i][j], " \n"[j+1 == m]);
  27. }
  28. }
  29. return 0;
  30. }
  31. #endif // FUNCTION10_H_
  32.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:7:31: error: unknown type name ‘bool’; did you mean ‘_Bool’?
 void calc_bombs(int n, int m, bool **is_bomb, int **count);
                               ^~~~
                               _Bool
prog.c: In function ‘main’:
prog.c:13:5: error: unknown type name ‘bool’; did you mean ‘_Bool’?
     bool *is_bomb[n];
     ^~~~
     _Bool
prog.c:15:23: error: ‘bool’ undeclared (first use in this function); did you mean ‘atol’?
         is_bomb[i] = (bool*) malloc(sizeof(bool)*m);
                       ^~~~
                       atol
prog.c:15:23: note: each undeclared identifier is reported only once for each function it appears in
prog.c:15:28: error: expected expression before ‘)’ token
         is_bomb[i] = (bool*) malloc(sizeof(bool)*m);
                            ^
prog.c:22:5: warning: implicit declaration of function ‘calc_bombs’; did you mean ‘wcstombs’? [-Wimplicit-function-declaration]
     calc_bombs(n, m, is_bomb, count);
     ^~~~~~~~~~
     wcstombs
prog.c:11:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ^~~~~~~~~~~~~~~~~~~~~
prog.c:18:13: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &is_bomb[i][j]);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
stdout
Standard output is empty