C strlwr

strlwr() is one of the inbuilt string function in c programming which is used to converts the UPPERCASED characters to lowercase characters.

Syntax - strlwr()
  • strlwr() accepts one parameter.
  • Parameter must be a string.
  • To use strlwr() inbuilt string function in C, we need to declare #include<string.h> header file.

 Example

#include <stdio.h>
#include<string.h>
int main()
{
char str[100];
   
   printf("\nEnter the String : ");
   gets(str);
printf(" Output of given string is %s ", strlwr(str));
return 0;

Output:

 

 

Without strlwr()

 #include <stdio.h>
#include<string.h>
int main()
{
char str[100],i;
   printf("\nEnter the strings :");
   gets(str);
   for(i=0; str[i]!='\0';i++)
{
if(str[i]!=32){
// filtering blank space
printf("%c",str[i]+32);
}
else
printf(" ");
}
return 0;
}

Output

 

No comments:

Post a Comment