In this post, you learn how to change the case of string. If you entered "A", the program will change it's case to "a" and vise-versa. Refer following examples:
#Example: Uppercase to Lowercase (strlwr)
#include <stdio.h>
#include <string.h>
void main()
{
char inpString[1000];
char lwrString[1000];
printf("Enter a string to convert to lower case:\n");
gets(inpString);
lwrString = strlwr(inpString);
printf("Your string in lower case: \"%s\"\n",lwrString);
}
Output
Enter a string to convert to lower case: HELLO Your string in lower case: hello
#Example: Lowercase to Uppercase (strupr)
#include <stdio.h>
#include <string.h>
void main()
{
char inpString[1000];
char uprString[1000];
printf("Enter a string to convert to upper case:\n");
gets(inpString);
uprString = strlwr(inpString);
printf("Your string in upper case: \"%s\"\n",uprString);
}
Output
Enter a string to convert to upper case: hello Your string in upper case: HELLO






