Get or Read String Using gets()

Get or Read String Using gets()

gets() accepts single or multiple characters of string including spaces from the standard Input device.

Declaration:

gets(variable_name);

Example Declaration:

char ch[10];

gets(ch);

Remarks:

gets() read string from the screen.

Example Program:

#include<stdio.h>
#include<conio.h>

void main()
{
   char a[20];
   gets(a);
   
   puts(a);
   getch();
}

Sample Output:

thiyagaraaj.com

thiyagaraaj.com