问题补充说明:编译器报错:[Error]expectedprimary-expressionbefore'['token那一行为:(人民币标注的是错误的地方)scanf("%s%s",s_1¥[i].state,s_1¥[i].key);这是我前文定义的一个结构体变量数... 编译器报错:[Error] expected primary-expression before '[' token那一行为:(人民币标注的是错误的地方)scanf("%s%s",s_1¥[i].state,s_1¥[i].key); 这是我前文定义的一个结构体变量数组:typedef struct Subject_mul{ char state[200]; char key[4];}s_1[20];以下是全部代码:目的是建立两个文件,分别存放单选和多选题#include #include typedef struct Subject_mul{char state[200];char key[4];}s_1[20];struct Subject_sin{char state[200];char key;}s_2[20];int main(){int i;FILE *fp,*fq;if((fp=fopen("多选题库","wb"))==NULL){printf("file writing error!");exit(0);}if((fq=fopen("单选题库","wb"))==NULL){printf("file writing error!");exit(0);}for(i=0;i<10;i++){printf("请输入第%d道多选题及其答案:\n",i+1);scanf("%s%s",s_1[i].state,s_1[i].key); fwrite(&s_1[i],sizeof(struct Subject_mul),1,fp); }putchar(10);for(i=0;i<10;i++){printf("请输入第%d道单选题及其答案:\n",i+1);scanf("%s%c",s_2[i].state,&s_2[i].key);fwrite(&s_2[i],sizeof(struct Subject_mul),1,fq);}putchar(10);printf("题库写入成功^_^"); return 0;} 展开
去地址符号在哪?还有,你的%s%s这个是怎么区分两个变量的?听过回车么?