fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main() {
  5. int x, y;
  6. x = 6;
  7. y = 4;
  8. int (*m)[x] = calloc(y,sizeof*m);
  9. for(int i=0;i<y;++i)
  10. for(int j=0;j<x;++j)
  11. m[i][j]=i+j;
  12. for(int i=0;i<y;++i,puts(""))
  13. for(int j=0;j<x;++j)
  14. printf("%2d",m[i][j]);
  15. free(m);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 2184KB
stdin
Standard input is empty
stdout
 0 1 2 3 4 5
 1 2 3 4 5 6
 2 3 4 5 6 7
 3 4 5 6 7 8