gpt4 book ai didi

c - `Build Error` 错误 -1073741819 - C

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

我的任务是从游戏 Boggle 中获取每个骰子的所有可能字母的数据文件。这是数据文件的副本:

   D R L X E I
C P O H S A
N H N L Z R
W T O O T A
I O S S E T
N W E G H E
B O O J A B
U I E N E S
P S A F K F
I U N H M Qu
Y R D V E L
V E H W H R
I O T M U C
T Y E L T R
S T I T Y D
A G A E E N

每个骰子取 6 个字母,这些字母存储在链表中。当我尝试运行以下代码时,我不断收到错误代码:C:\Dev-Cpp\Makefile.win [Build Error] [Untitled1.o] Error -1073741819

我试过使用 3 种不同的 IDE,但似乎总是遇到一些编译问题。我似乎无法弄清楚我要去哪里错了!无论如何这还没有完成,但我宁愿在我继续深入之前弄清楚这一点。提前致谢!

代码:

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


#define LENGTH 80

struct boggleDataNode{
char data[3];
struct boggleDataNode *nextData;
}*head;

struct boggleDieSideNode{
char dieSideData[3];
struct boggleDieSideNode *nextSide;
}*head1;

void readData(struct boggleDataNode temp);

int main(){
int counter = 0;
struct boggleDataNode *head;
struct boggleDieSideNode *head1;
struct boggleDataNode *temp;
*head = NULL;
*head1 = NULL;
*temp = *head;
readData(*temp);


system("pause");
return 0;
}
void readData(struct boggleDataNode temp){
//initializing variables including
//opening the input file
FILE *input = fopen("BoggleData.txt","r");
int name =0;
int id=0;
char data[96] ={};

//error checking that the file opened
if (input == NULL){
fprintf(stderr, "Can't open input file!\n");
exit(1);
}
while( fscanf(input, "%s", &data) != EOF)
printf("%s", data);

}

最佳答案

在你的代码中,改变

struct boggleDataNode{
char data[3];
struct boggleDataNode *nextData;
}*head;

struct boggleDataNode{
char data[3];
struct boggleDataNode *nextData;
};

因为看起来您无论如何都不需要该结构的全局指针。根据您的使用情况,它将被本地 head 隐藏

head1 也是如此。

接下来,您将 NULL 分配给指针本身,而不是分配给它指向 的变量。 (FWIW,NULL 本身是一个指针,不过是一个无效指针)。

改变

*head = NULL;

head = NULL;

关于c - `Build Error` 错误 -1073741819 - C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31013245/

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