C – Gets 2017-07-19T19:18:06+00:00

Gets :

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.


Output :

Enter a string

Good morning

Given string is Good morning

Prev Next