Q:

Why does fgets() return a pointer to the newly filled char array?

I can use fgets in the following way:
FILE *fp = fopen("text.txt", "r");
if(fp == NULL)
  return 1;

char line[50];
fgets(line, 50, fp);

// do more stuff

This fills line as expected with chars from the file, so why does fgets()
need to return a pointer to line? line now contains the data I needed so what use is it returning a pointer to it?

A:

Because it is documented in fgets(3) and in POSIX fgets to do so.
Also, if you are sure that it does return a non-NULL pointer (i.e. that it does not fail), you might use its result as argument to some other function. I think it is a mistake to not test it.
BTW, I generally recommend using the newer POSIX getline which is able to deal with arbitrarily long lines (as long as resources permit it) -and returning on success the line length.

