gpt4 book ai didi

c - 23 警告 : assignment makes pointer from integer without a cast

转载 作者:行者123 更新时间:2023-12-04 23:56:32 24 4
gpt4 key购买 nike

<分区>

我是使用数组和文件进行 C 编程的新手。 我只是想运行以下代码,但我收到这样的警告:

23 44 warning: assignment makes pointer from integer without a cast

53 error: expected expression before ‘char’

有什么帮助吗?这可能很愚蠢……但我找不到问题所在。

#include <stdio.h>

FILE *fp;
FILE *cw;
char filename_game[40],filename_words[40];

int main()
{
while(1)
{
/* Input filenames. */
printf("\n Enter the name of the file \n");
gets(filename_game);
printf("\n Give the name of the file2 \n");
gets(filename_words);

/* Try to open the file with the game */
fp=fopen(/* args omitted */); //line23**
if (fp!= NULL)
{
printf("\n Successful opening %s \n",filename_game);
fclose(fp);
puts("\n Enter x to exit,any other to continue! \n ");
if ( (getc(stdin))=='x')
break;
else
continue;
}
else
{
fprintf(stderr,"ERROR!%s \n",filename_game);
puts("\n Enter x to exit,any other to continue! \n");
if (getc(stdin)=='x')
break;
else
continue;
}

/* Try to open the file with the names. */ //line 44**
cw=fopen(/* args omitted */);
if ( cw!=NULL )
{
printf("\n Successful opening %s \n",filename_words);
fclose(cw);
puts("\n Enter x to exit,any other to continue \n ");
if ( (getc(stdin))=='x')
break; //line 53**
else
continue;
}
else
{
fprintf(stderr,"ERROR!%s \n",filename_words);
puts("\n Enter x to exit,any other to continue! \n");
if (getc(stdin)=='x')
break;
else
continue;
}
}
return 0;
}

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