Patrick B. answered 03/10/19
Math and computer tutor/teacher
Arrays that large blow up the heap
you can SIMULATE the timing exercise by multiplying corresponding elements of
TWO (2) arrays of 10000 numbers, WITHING a loop that executes 10000 times
#include <stdio.h>
#include <time.h>
#define N (1000)
void Go()
{
int A[N][N];
int B[N][N];
int C[N][N];
int iLoop,jLoop, kLoop;
int sum=0;
clock_t start = clock();
printf("%12.6f \n",start);
for (iLoop = 0; iLoop < N; iLoop++)
{
for (jLoop = 0; jLoop < N; jLoop++)
{
C[iLoop][jLoop] = 0;
for (kLoop = 0; kLoop < N; kLoop++)
{
C[iLoop][jLoop] += A[iLoop][kLoop]*B[kLoop][jLoop];
}
}
printf("%d\n",iLoop);
}
clock_t stop = clock();
double ttimediff = (double) (stop-start);
printf("%12.6f",ttimediff);
}
int main()
{
Go();
}