Question: why we use fgets in c?
Answer: The fgets() function in C reads up to n characters from the stream (file stream or standard input stream) to a string str . The fgets() function keeps on reading characters until: (n-1) characters have been read from the stream. a newline character is encountered.