I'm curious about one thing, the following code works perfectly.
#include <stdio.h>
int main()
{
FILE * fp = fopen("test.txt", "r");
char line[100];
while( fgets(line, sizeof(line), fp) != NULL )
fputs(line, stdout);
fclose(fp);
return 0;
}
But why it is not possible to use instead:
char *line;
Without causing fgets to crash?