C – Gets

C – Gets 2017-08-05T19:23:35+00:00

Gets :

Gets function is used to scan a  line of text from a standard input device. This 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);

This 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, shall return a pointer to string s.

C – EXAMPLE PROGRAM :

Output :

Enter a string

Good morning

Given string is Good morning

Prev Next