I am trying to write a program for adding 2 matrices.
If I increase the matrix size I get the following error:
Segmentation fault (core dumped)
Here is my code:
#include <iostream>
using namespace std;
int main()
{
int thrd ;
int m = 1000 ;
int n = 1000 ;
int a[m][n] ;
int b[m][n] ;
int c[m][n] ;
for(int i=0 ; i<m ; i++)
for(int j=0 ; j<n ; j++)
{
a[i][j] = 0 ;
b[i][j] = 0 ;
}
for(int i =0 ; i<m ; i++)
{
for(int j=0 ; j<n ; j++)
c[i][j] = a[i][j] + b[i][j] ;
}
return 0 ;
}
So what should I do?
I'd appreciate any help on this error.