我使用 VC2010,当我尝试用 struct
替换 static
调试我的程序时,我得到了
Unhandled exception at 0x000f18e7 in ht_array.exe: 0xC00000FD: Stack overflow.
它在main的第一行执行
#define BUCKETS 64
#define B_ENTRIES 50000
void main(int argc, char **argv)
{
static fpinfo hash_table[BUCKETS][B_ENTRIES];
static tanker_record tr[100];
....
最佳答案
因为 64 * 50000 * sizeof(fpinfo)
字节对于您的堆栈来说显然太大了。使用 static
,变量被分配到适合它的不同内存区域。
关于c - 为什么在我的程序开始时删除 static 会出现 ' Stack overflow' 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9483805/