-2
I have to develop a function in the C language to sum the elements of a square matrix of order n since i < j. I tried to test the function I did, but it gives error in line 15, which says "expected Expression before 'int'". Could someone help me, please?
#include <stdio.h>
#include <stdlib.h>
int soma_matriz(int n, int mat[n][n]){
int i = 0, j = 0, soma = 0;
for (i = 0; i < n; i++){
for (j = 0; (j < n); j++){
if (i < j)
soma = soma + mat[i][j];
}
}
return soma;
}
int main(){
int mat[3][3] = {1, 1, 1, 1, 1, 1, 1, 1, 1}, a = 3, somatorio = 0;
somatorio = soma_matriz(int a, int mat[3][3]);
printf("O valor e %d", somatorio);
return 0;
}