I'm trying to create a C program to measure how long it takes to copy a 2D array into another. When I run my code, I get:
exited with code=3221225725
Now, this is code provided by the instructor, character for character, but it seems to work for him and not for me. Any idea why I get a stack overflow and he doesn't? When I use a number smaller than 512, it works, but it has to be 512 for my assignment.
#include <stdio.h>
#include <time.h>
int main()
{
clock_t start, end;
double time_elapsed;
int i, j;
int src[512][512];
// initialize src
for (i = 0; i < 512; i++)
for (j = 0; j < 512; j++)
src[i][j] = i*512 +j;
int dst[512][512];
start = clock();
// data copy to measure
for (i = 0; i < 512; i++)
for (j = 0; j < 512; j++)
dst[j][i] = src[j][i];
end = clock();
time_elapsed = ((double) (end - start)) / CLOCKS_PER_SEC;
/*
// print dst for verification
for (i = 0; i < 512; i++)
for (j = 0; j < 512; j++)
printf("\n%d\n", dst[i][j]);
*/
printf("%f\n", time_elapsed);
return 0;
}