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
Next Topic : To enter any Character and display it's ASCII Value
Previous Topic : To accept a string from keyboard and display the string
No comments:
Post a Comment