C programming stdio.h function - char *gets(char *str)

The gets() function is a function from the standard C library declared in the stdio.h header file. However, it is no longer recommended to use this function in modern C programming, because it is unsafe and can lead to buffer overflow vulnerabilities.

The gets() function reads a line from stdin and stores it in the string pointed to by str. The input is terminated by a newline character '\n' or by the end-of-file character EOF. The newline character is included in the string.

Here is the function signature for gets():

‮ot refer‬:theitroad.com
char *gets(char *str);

The str parameter is a pointer to the buffer where the input string will be stored. The function returns the pointer to str on success, and NULL on failure or end-of-file.