0

Hi. I am doing this program checking & comparing the speed of cache of two loops below, and I keep getting error "Automatic allocation exceeds 2G". I am trying to use dynamic array to make this work. Can anyone help me using Dynamic array? I am little lost on that. Here is the code I have.

```
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
const int MAX = 100000;
double A[MAX][MAX],B[MAX][MAX],C[MAX][MAX];
//starting the clock #1
clock_t start, finish;
start = clock();
// Initializing array A elements with random numbers (Dinamically Allocate)
// 1st loop
for(int j=0;j<MAX;j++)
{
for(int i=0;i<MAX;i++)
{
B[i][j]=i*j;
}
finish = clock(); // stop clock #1
( (finish - start)/CLOCKS_PER_SEC );
cout << "Time spent #1 = " << finish << " mili_seconds" << endl;
}
cout << '\n' << endl;
// Marginal codes.....
//starting the clock #2
clock_t start2, finish2;
start2 = clock();
// 2nd loop
for(int j=0;j<MAX;j++)
{
for(int i=0;i<MAX;i++)
{
C[i][j]= A[i][j]+B[i][j];
}
finish2 = clock(); // stop clock #2
( (finish2 - start2)/CLOCKS_PER_SEC );
cout << "Time spent #2 = " << finish2 - finish << " mili_seconds"<< endl;
}
}
```