The following code produces segmentation fault 11 when run, I couldn't figure out why. Could anyone offer some insight? Thanks in advance.
#include <stdio.h>
int main() {
int s, e;
int i,j;
typedef struct coordinate {
int x;
int y;
} coordinate;
typedef struct cell {
int altitude;
coordinate lowest_neighbor;
int visited;
int basin;
} cell;
cell cells[1000][1000];
for (i = 0; i < 1000; i++){
for (j = 0; j < 1000; j++){
cells[i][j].altitude = 9;
}
}
printf("%d", cells[0][0].altitude);
return 0;
}