gets function

 gets:

                It is a function and is used to read a string(including spaces) from the standard input device(KeyBoard).

Syntax:

                gets(string variable);

Eg:    gets(st);

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    char st[80];
    clrscr();
    printf("Enter any string : ");
    gets(st);
    printf("Given string is : %s", st);
    getch();
}

Output:

Enter any string : welcome to STR Educational Tutorials
Given string is : welcome to STR Educational Tutorials


No comments:

Post a Comment