fork download
  1. #include <stdio.h>
  2.  
  3. #define ROWCOL_MULTIPLIER 50
  4.  
  5. int main() {
  6. size_t loop, i, j;
  7.  
  8. for (loop = 0; loop < 11; loop++) {
  9. const double val = loop * ROWCOL_MULTIPLIER;
  10. double *column_sum = malloc(sizeof(double) * val * val);
  11. double *p = malloc(val * val * sizeof *p);
  12.  
  13. // do foo things
  14.  
  15. for (i = 0; i < val; i++) {
  16. column_sum[i] = 0;
  17. for (j = 0; j < val; j++) {
  18. column_sum[i] += p[j][i];
  19. }
  20. }
  21.  
  22. free(p);
  23. free(column_sum);
  24. }
  25. return 0;
  26. }
Compilation error #stdin compilation error #stdout 0s 2288KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:10:3: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
   double *column_sum = malloc(sizeof(double) * val * val);
   ^
prog.c:10:24: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default]
   double *column_sum = malloc(sizeof(double) * val * val);
                        ^
prog.c:18:25: error: subscripted value is neither array nor pointer nor vector
     column_sum[i] = p[j][i];
                         ^
prog.c:22:3: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
   free(p);
   ^
prog.c:22:3: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
stdout
Standard output is empty