I wanted to declare 4 2-D arrays of size 1000*1000(4*10^6*4 bytes considering int) . Initially, when I declared these arrays in main() function, I was getting segmentation fault.
Later I declared the arrays globally and the program worked fine. Why this is so??