gets function
Reads characters from the standard input, until a newline character or the end-of-file is reached.
puts function
Puts function is used to output strings.
Example of gets and puts :
#include <stdio.h>
int main()
{
char str[100];
printf( "Enter a string : ");
gets( str );
printf( "\nEntered String : ");
puts( str );
return 0;
}
Output :
Enter a string : Hello World Entered String : Hello World
Explanation :
The gets function stores the input in str and puts function displays that string str.
No comments:
Post a Comment