Read a character array from stdin.
#include <stdio.h> char *gets(char *s);
s
The string being written to.
The gets() function reads characters from stdin and stores them sequentially in the character array pointed to by s. Characters are read until either a newline or an end-offile is reached.
This function reads and ignores the newline character ( '\n'). The newline character is not stored s. The function terminates the character string with a null character.
This function can be the cause of buffer overflow bugs because it does not limit the number of characters that it stores in s. use the function fgets() instead, which allows the programmer to specify the length of the character string where input will be stored.
If an end-of-file is reached before any characters are read, gets() returns a null pointer ( NULL) without affecting the character array at s. If a read error occurs, the contents of s may be corrupted.
gets() returns s if it is successful and returns a null pointer if it fails.