fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. //必要があれば変数などを追加してもOKです
  5.  
  6. int main(){
  7. int i,j,k;
  8. int a,b;
  9. int **mat;
  10. scanf("%d %d",&a,&b);
  11.  
  12. mat = malloc(a*sizeof(int*));
  13. for(i=0;i<a;i++){
  14. mat[i]=malloc(b*sizeof(int));
  15. }
  16.  
  17. for(i=0;i<a;i++){
  18. for(j=0;j<b;j++){
  19. printf("%d ",mat[i][j]);
  20. }
  21. printf("\n");
  22. }
  23.  
  24. free(mat);
  25.  
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 5304KB
stdin
2 2
stdout
0 0 
0 0