Why do I get a segfault in C from declaring a large array on the stack?

前端 未结 5 573
野趣味
野趣味 2020-11-27 08:59

I get a segfault from this line of code:

int fatblob[1820][286][5];

Why is that?

5条回答
  •  渐次进展
    2020-11-27 09:27

    Because your stack segment is smaller then 1820*285*5 ints. It's usually in a neighborhood of 1MB.

提交回复
热议问题