大哥们,普通的数组赋值不知为何出现 [error] expected primary -expression before ']' token 怎么办?
#include "stdio.h"#include "stdlib.h"
int main()
{
FILE *fp;
char a[12];
char str1[100];
a[]="hello world"; /* 是这行代码显示错误 */
if((fp=fopen("D:\\项目编程.txt","w+"))==NULL)
{
printf("打开文件失败");
exit(0);
} printf("调试1");
fprintf(fp,"%s",a);
fscanf(fp,"%s",str1);
printf("%s",str1);
return 0;
}
错误显示: [error] expected primary -expression before ']' token 怎么改?