1
This function I created needs to calculate the summing up of each column of the matrix and store in a vector position. However, it is not giving the desired result, I think it may be within the thirdfor
.
Can anyone help me in relation to saving the result of the sum of the matrix in the vector?
void soma(int mat[] [MAX], int n, int m, int v[])
{
int i,j,soma=0;
int res, x=0;
for (i = 0; i < n; i ++)
{
for ( j = 0; j < m ;j ++)
{
for(x=0; x < m; x++)
{
soma=soma+ mat[i][j];
res[v]=soma;
printf(" %d\n",res );
}
}
}
}