gpt4 book ai didi

c - 如何声明其中包含大型结构数组的结构

转载 作者:太空宇宙 更新时间:2023-11-04 08:12:35 25 4
gpt4 key购买 nike

<分区>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAXNO 1000

typedef struct
{
int n;
char site[4];
} stru;

typedef struct
{
stru t1[MAXNO];
stru t2[MAXNO];
} struall;

int main()
{
struall tmp;
int i;
printf("%d\n",i);
return 1;
}

大家好,我正在尝试声明一个结构变量,其中包含两个结构数组成员。如果数组大小 (MAXNO) 很小,我可以编译成功。但是,如果数组大小非常大(将 MAXNO 定义为 1000000),声明将因段错误而失败。

谁能告诉我原因?

非常感谢!

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com