fork(1) download
  1. #include <stdio.h>
  2. #define DIM 2
  3.  
  4. void retorna_matriz2D(int mat[][DIM]) {
  5. for (int x = 0; x < DIM; x++) {
  6. for (int y = 0; y < DIM; y++) {
  7. mat[x][y] = 2;
  8. printf("%d\n", mat[x][y]);
  9. }
  10. }
  11. }
  12.  
  13. int main(){
  14. int mat2D[DIM][DIM];
  15. retorna_matriz2D(mat2D);
  16. for (int x = 0; x < DIM; x++) for (int y = 0; y < DIM; y++) printf("%d\n", mat2D[x][y]);
  17. }
  18.  
  19. //https://pt.stackoverflow.com/q/235989/101
Success #stdin #stdout 0s 4408KB
stdin
Standard input is empty
stdout
2
2
2
2
2
2
2
2