所需的for loop开始之后fopen,具体for (i=0;1;i++)到底是什么?什么时候for loop会终止?达到价值后i=1?什么时候会发生?(在互联网和书C中寻找这种类型的循环(如何编程,Deitel和Deitel),没有任何结果......)(代码的目的是将多行转换final.txt为字符串words[i][j];)
int lines_allocated = 1000;
int max_line_len = 150;
double c[42][1000]={0};
int print;
char **words = (char **)malloc(sizeof(char*)*lines_allocated);
if (words==NULL)
{
fprintf(stderr,"Out of memory (1).\n");
exit(1);
}
FILE *fp = fopen("final.txt", "r");
if (fp == NULL)
{
fprintf(stderr,"Error opening file.\n");
exit(2);
}
int i;
for (i=0;1;i++)
{
int j;
if (i >= lines_allocated)
{
int new_size;
new_size = lines_allocated*2;
words = (char **)realloc(words,sizeof(char*)*new_size); …Run Code Online (Sandbox Code Playgroud)