Pages

How to enter string

//How to enter string.


#include<stdio.h>
#include<conio.h>

void main()
{
  char str[100]; //Declare string variable
  clrscr();
  printf("Enter the string:");
  scanf("%s",&str);
  printf("\nYou entered: %s",str);
  getch();
}

Output:

Enter the string:abc
You entered: abc

No comments:

Post a Comment