我需要访问我在从文件读取的第一行创建的可变长度数组。为了在我阅读以下行时访问该数组,我需要在第 1 行被读出我的条件语句之前对其进行初始化。但这是在我知道数组的长度之前。
这是我的代码示例
int count=0;
while (fgets(line, sizeof(line), fd_in) != NULL) {
if(count==0){
//get wordcount from line
int word[wordcount];
//put line data into array, using strtok()
}else{
//need to access the array here
}
count++;
}
编辑:我的问题是我应该如何才能在我需要的地方访问这个数组?