Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Erro índice matriz ------------

#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;
            printf("%d\n", mat[x][y]);
        }
    }
}

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

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.