Input and Output in C 77
4.19 Write a program to print the accepted character using putsO function.
# include <stdio.h>
mainO
{
char ch [30];
clra c rO ;
printf("Enter the String: ");
gets(ch);
puts ("EnteredString:");
puts(ch);
I
OUTPUT;
Enter the String: puts is in use.
Entered String:
puts is in use.
Explanation This program is same as the previous one. Here, to display the string puts () function
is used.
3. cge t s () This function reads string from the console. The syntax is as per given below.
Syntax
cgets ( char * s t ) ;
It requires character pointer as an argument. The string begins from s t [ 2 ].
4. cput s () This function displays string on the console. The syntax is as per given below.
Syntax
cputs (char * s t ) ;
4.20 Write a program to read string using cgetsO and display it using cputsO.
# include <stdio.h>
# include <conio.h>
void main ()
{
static char * t ;
c lrs cr () ;
printf (" Enter Text H ere:");
cgets(t);
t+=2;
printf (" Your Entered T ext:");
cputs(t);
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.15.154