Segmentation fault in C
问题 I need to fill 2-d array with 0s. But compiled program falls with this error. What's wrong? int main() { int vert[1001][1001]; int hor[1001][1001]; int dudiag[1416][1416]; int uddiag[1416][1416]; int n, k, m; int row, col; int i, j; int answer = 0; for(i = 0; i <= 1000; i++){ for(j = 0; j <= 1000; j++){ vert[i][j] = 0; hor[i][j] = 0; } } ... } When cycle is commented out, it works properly. 回答1: The problem is that you are trying to allocate too much memory in the automatic store (AKA "on the