I’m trying to compile a C file using gcc. I’m in the right directory and all the files included in the C file i’m trying to compile is in the same directory. I can compile other files but I can’t compile files that are using this ADT Matrix. the files I have in this directory
#include <stdio.h>
#include "matrix.c"
#include <math.h>
int main(){
int n,i,j,k,l;
int count;
Matrix m;
scanf("%d", &n);
readMatrix(&m, n, n);
for (i=0; i<n; i++){
for (j=0; j<n; j++){
if (ELMT(m,i,j)==0){
continue;
} else
for (k=i+1; k<n; k++){
//printf("i = %d, j = %d, k = %d\n", i, j, k);
//printf("ELMT(k,j) = %d\n",ELMT(m,k,j));
if (ELMT(m,k,j)!=0){
count += ELMT(m,k,j);
}
}
for (k=i-1; k>=0; k--){
//printf("i = %d, j = %d, k = %d\n", i, j, k);
//printf("ELMT(k,j) = %d\n",ELMT(m,k,j));
if (ELMT(m,k,j)!=0){
count += ELMT(m,k,j);
}
}
for (k=j+1; k<n; k++){
//printf("i = %d, j = %d, k = %d\n", i, j, k);
//printf("ELMT(i,k = %d\n", ELMT(m,i,k));
if (ELMT(m,i,k)!=0){
count += ELMT(m,i,k);
}
}
for (k=j-1; k>=0; k--){
//printf("i = %d, j = %d, k = %d\n", i, j, k);
//printf("ELMT(i,k = %d\n", ELMT(m,i,k));
if (ELMT(m,i,k)!=0){
count += ELMT(m,i,k);
}
}
}
}
int mod = 1000000007;
count = count % mod;
printf("%d\n", count);
//printf("%d\n", count);
return 0;
}
this is kekacauan.c
I was expecting the code to run as usual, but it exited with code 127.
You need to sign in to view this answers