gpt4 book ai didi

c - 使用malloc后,程序突然要求输入

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

<分区>

我是一个新手程序员

//allocating space for final output
//text_count is given by another function, let's just say i have a value for it
//out is my typedef struct

out *fin[text_count];

for(i=0; i<text_count; i++){
fin[i] = malloc(sizeof(out));
}

//this is a test
fin[1]->appearances = 1;

printf("%d",fin[1]->appearances);

// ..other code

我注意到在这个分配之后,程序突然输出:

1_

下划线在闪烁,表示需要输入。

我的问题是什么?是分配吗?或者下面的代码?

好的,抱歉,让我澄清一下,我正在使用代码块。所以当我看到一个闪烁的光标时,这意味着它需要输入。在我得到这个输出之后,输入的无限循环似乎正在发生。

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