0
Dear friends, today I have come across a problem I cannot understand. When trying to pass an array as a parameter, I cannot access the values of the elements, I always access the memory addresses of the elements of the second line downwards. Why this occurs? Follow the code of my program that appeared error.
I used the master stdio library. h and the constant MAX
#include <stdio.h>
#define MAX 10
Call on main:
int mat[3][3] = {8, 0, 7, 4, 5, 6, 3, 10, 2};
verifica_quadrado_magico(mat, 3);
Body of function:
void verifica_quadrado_magico(int matriz[][MAX], int dim){
int i, j, somaDP = 0, somaDS = 0, somaL, somaC, somaL0 = 0;
int igual = 0;
for(i = 0; i < 3; i++){
for(j = 0; j < 3; j++){
printf("%i\t", matriz[i][j]);
}
printf("\n");
}
//Continua, mas até aqui já é o suficiente para entender meu problema
Thank you for the explanation, my dear!
– Victor Rafael