C Programming Language


                 It is used to scan a  line of text from a standard input device. The gets() function will be terminated by a newline character. The newline character won't be included as part of the string. The string may include white space characters.

Syntax :      char *gets(char *s);

                gets() function is declared in the header file stdio.h. It takes a single argument. The argument must be a data item representing a string. On successful completion, gets() shall return a pointer to string s.

               The usage of gets() is illustrated in the following program.

gets function
getchar Home printf

c program stats