Learn C with example
Print the multiword string.
In this section you will learn how you can
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 Of Example
Here you can enter string with
space.
Enter the string: Rajesh Kumar (B.Tech-CS)
Your string is:
Rajesh Kumar (B.Tech-CS) |