📅  最后修改于: 2022-03-11 14:55:11.226000             🧑  作者: Mango
//This will reserve 100 character arrays, or 100 strings
char *arr[100];
int count = 0;
while (fscanf(fp, "%999s", str) == 1)
{
arr[count] = malloc(strlen(str) + 1);
strcpy(arr[count], str);
count++;
if (count == 100)
break;
}
int i;
for (i = 0; i < count; i++)
printf("%s\n", arr[i]);