寻求帮助,C语言!!!

2401_88065888 2024-11-19 23:43:00

#include <stdio.h>
#include<stdlib.h>
#include<string.h>
   char** a;
   int d[10001];
    char b[1000001];
int main()
{
 
    int m,n,j,i,c;
   
    scanf("%d%d",&n,&m);
        a=(char**)malloc(n*sizeof(char*));
    for(i=0;i<n;i++)
    {
        scanf("%d%s",&d[i],b);
        a[i]=(char*)malloc(d[i]*sizeof(char*));
        for(j=0;j<d[i];j++)
            a[i][j]=b[j];
    }
      
    for(i=0;i<m;i++)
    {
        scanf("%d",&c);
        c--;
        for(j=0;j<d[c];j++){
            printf("%c",a[c][j]);}
        printf("\n");
    }
    for ( i = 0; i < n; i++) {
        free(a[i]);
    }
    free(a);
    system("pause");
    return 0;
}为什么   char** a;
   int d[10001];
    char b[1000001];这个要设置全局变量放在int main中就出现“System.StackOverflowException”类型的未经处理的异常出现在 未知模块 中,求帮助

...全文
61 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

3,882

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧