Program:
#include<stdio.h>
#include<conio.h>
void main()
{
char st[80];
clrscr();
printf("Enter any string: ");
scanf("%s", st);
printf("Given String is : %s", st);
getch();
}
Output:
1. Enter any string : welcome
Given String is : welcome
2. Enter any string : welcome to STR Educational Tutorials
Given String is : welcome
Note:
scanf statement cannot read spaces into a string variable.
No comments:
Post a Comment