Write a program that demonstrates the use of scanset in scanf().

C Programming Language / String in C Language

27916

Program:

// Write a program that demonstrates the use of scanset in scanf().

#include<stdio.h>

int main()
{
  char str[50];
  
  printf("Enter a string in lower case:");
  scanf("%[a-z]",str);
  
  printf("The string was : %s\n",str);
  
  return 0;
 }

Output:

Enter a string in lower case:atnyla
The string was : atnyla

 

Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.