I'm getting the segmentation fault error in the code below:
#include <stdio.h>
#include <stdlib.h>
#define linha 1000
#define coluna 1000
int main() {
long double M1[1000][1000];
long double M2[1000][1000];
long double matrizResultante[1000][1000];
/** multiplicando a matriz **/
for(int i = 0; i < linha; i++) {
for(int j = 0; j < coluna; j++) {
matrizResultante[i][j] = 0;
for(int k = 0; k < coluna; k++) {
matrizResultante[i][j] += M1[i][k] * M2[k][j];
}
}
}
return 0;
}
The purpose of this code is to analyze the access rates to cache memory, my suspicion is that the error is being generated by not initializing the array, but because the values are large the initialization is infeasible. Is this really the problem?
I'm using gcc to compile the code.