这是什么原因啊,怎么修改呢
#include<stdio.h>
#include<string.h>
typedef struct{
int no;
char name[10];
float score;
}student;
int main()
{
student s[3]={{1001,"张三",95},{1002,"蔡四",96},{1003,"罗五",97}};
int i;
FILE *fp;
if(fp=fopen("student.txt","w+"))==NULL)
{
printf("文件打开失败");
return 0;
}
for(i=0;i<3;i++)
fprintf(fp,"%d %s %.2f\n",s[i].no,s[i].name,s[i].score);
fclose(fp);
return 0;
}

[Error] expected primary-expression before '==' token
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- qzjhjxj 2021-12-26 22:53关注
if(fp=fopen("student.txt","w+"))==NULL) 少了 '(' ,修改如下:if((fp=fopen("student.txt","w+"))==NULL)
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用