C ++中的分段错误 [英] Segmentation fault in c++
本文介绍了C ++中的分段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在函数中将以下变量声明为局部变量,而将这些变量声明为全局变量时,代码运行良好,我遇到了分段错误问题:
i have a segmentation fault problem when i declared the following variables as local variables in the function while the code worked well when these variables declared as global variables :
#define MAX_GRPS 1000
#define MAX_GRP_SIZE 3500
int grp_strs[MAX_GRPS][MAX_GRP_SIZE][6];
int grp_counter[MAX_GRPS];
推荐答案
是因为您现在正尝试分配大约80 MB的程序堆栈.
最好的问候
Espen Harlinn
That''s because you are now attempting to allocate about 80 MB of the program stack.
Best regards
Espen Harlinn
这篇关于C ++中的分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文