fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int i,j;
  7. int ***matr, r = 5, c = 5;
  8. matr = malloc(sizeof(int**));
  9. *matr = malloc(r*sizeof(**matr));
  10. for (i=0; i<r; i++)
  11. matr[0][i]=malloc(c*sizeof(**matr));
  12.  
  13. for (i=0; i<r; i++)
  14. for (j=0; j<c; j++)
  15. (*matr)[i][j]=i+j;
  16. for (i=0; i<r; i++)
  17. {
  18. for (j=0; j<c; j++)
  19. printf("%d ", (*matr)[i][j]);
  20. puts("\n");
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 2288KB
stdin
Standard input is empty
stdout
0 1 2 3 4 

1 2 3 4 5 

2 3 4 5 6 

3 4 5 6 7 

4 5 6 7 8