将数据读入数组时遇到奇怪的错误.我的目标是逐行读取具有单列数字的文件到一个数组中.
#include <stdio.h>
int main() {
int numArray = [20];
int i = 0;
FILE *infile;
infile = fopen("numbers", "r");
while(!feof(infile))
{
fscanf(infile,"%d",&numArray[i]);
i++;
}
fclose(infile);
return 0; }
Run Code Online (Sandbox Code Playgroud)
这是我的编译错误:
sort_algorithms.c:在函数'main'中:sort_algorithms.c:6:错误:在'['标记sort_algorithms.c:16之前的预期表达式:错误:下标值既不是数组也不是指针