0

I tried running this simple matrix multiplication code to test that the limits & surprisingly I found that on windows this runs only up to a 100x100 matrix while on Linux it runs up to 590x590.Every time I execute the file on windows it says "Program stopped working...". I want to know why does this happen & if this code can run on windows then how...

#include<string.h>
#include<stdio.h>
int main(void)
{
 int i,j,k;double sum,x=0;
 double matrix1[590][590];
 double matrix2[590][590];
 double matresult[590][590];
 for(i=0;i<590;i++)
   {
    for(j=0;j<590;j++)
      {
        matrix1[i][j]=x++;
        matrix2[i][j]=x++;
      }
  }
 for(i=0;i<590;i++)
   {
    for(j=0;j<590;j++)
      {
        sum=0;
       for (k=0;k<590;k++)
           {
            sum = sum +matrix1[i][k]*matrix2[k][j];
           }
        matresult[i][j] =  sum;
      }
   }
   for(i=0;i<590;i++)
   {
    for(j=0;j<590;j++)
      {
       printf("%f\t",matresult[i][j]);
      }
     printf("\n");
    }
// getch();
 return 0;
}

0 Answers0