C Programming language

adplus-dvertising
C Program example: Take multiword string from keyword
Previous Home Next
Take multiword string from keyword

In this we are using two new functions gets(char c[]) and puts(char c[]). The gets(char c[]) is used to get array of character from keyboard and store it into an array variable c[] .The puts(char c[]) method is used to take values from character array c[] and display on screen.

Here we are using getch() method to take a value from keyboard. This is used to halt the screen until you are not press any key on keyboard.

/* Print the multiword string */

#include<stdio.h>
#include<conio.h>
void main()
{
	char c[10];
	clrscr();
	printf("Here you can enter string with space.\n");
	printf("Enter the string:\t");
	gets(c);
	puts("Your string is:\t");
	puts(c);
	getch();
}
Output :

Here you can enter string with space.

Enter the string: Rajesh Kumar (B.Tech-CS)

Your string is: Rajesh Kumar (B.Tech-CS)

Previous Home Next