#include <stdio.h>
#define DIM 2
void retorna_matriz2D(int mat[][DIM]) {
for (int x = 0; x < DIM; x++) {
for (int y = 0; y < DIM; y++) {
mat[x][y] = 2;
}
}
}
int main(){
int mat2D[DIM][DIM];
retorna_matriz2D(mat2D);
for (int x
= 0; x
< DIM
; x
++) for (int y
= 0; y
< DIM
; y
++) printf("%d\n", mat2D
[x
][y
]); }
//https://pt.stackoverflow.com/q/235989/101
I2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgRElNIDIKCnZvaWQgcmV0b3JuYV9tYXRyaXoyRChpbnQgbWF0W11bRElNXSkgewogICAgZm9yIChpbnQgeCA9IDA7IHggPCBESU07IHgrKykgewogICAgICAgIGZvciAoaW50IHkgPSAwOyB5IDwgRElNOyB5KyspIHsKICAgICAgICAgICAgbWF0W3hdW3ldID0gMjsKICAgICAgICAgICAgcHJpbnRmKCIlZFxuIiwgbWF0W3hdW3ldKTsKICAgICAgICB9CiAgICB9Cn0KCmludCBtYWluKCl7CiAgICBpbnQgbWF0MkRbRElNXVtESU1dOwogICAgcmV0b3JuYV9tYXRyaXoyRChtYXQyRCk7CiAgICBmb3IgKGludCB4ID0gMDsgeCA8IERJTTsgeCsrKSBmb3IgKGludCB5ID0gMDsgeSA8IERJTTsgeSsrKSBwcmludGYoIiVkXG4iLCBtYXQyRFt4XVt5XSk7Cn0KCi8vaHR0cHM6Ly9wdC5zdGFja292ZXJmbG93LmNvbS9xLzIzNTk4OS8xMDE=