C Program To Convert String into Lowercase Characters
Learn How To Convert String into Lowercase Characters in C Programming Language. This C Program demonstrates the use of Library Functions tolower() method.
The tolower() method is defined in the ctype.h header file. The strlen() method is defined in the string.h header file. The second method makes use of ASCII value conversion. The tolower() method converts the character into its corresponding Lowercase letter.
Must Read: C Program For Conversion of String into Uppercase Characters
C Program To Convert String into Lowercase using Library Functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include<stdio.h> #include<ctype.h> #include<string.h> int main() { int count = 0, length = 0; char str[100]; printf("\nEnter A String:\t"); scanf("%s", str); printf("\nOriginal String:\t%s\n", str); length = strlen(str); while(count < length) { str[count] = tolower(str[count]); count++; } printf("\nAfter Character Conversion\n"); printf("\nNew String:\t%s\n", str); return 0; } |
Must Read: C Program To Replace A Character in String with *
C Program For String Conversion into Lowercase without toupper() method (ASCII Values)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include<stdio.h> #include<ctype.h> #include<string.h> int main() { int count, length = 0; char str[100]; printf("\nEnter A String:\t"); scanf("%s", str); printf("\nOriginal String:\t%s\n", str); length = strlen(str); for(count = 0; count < length; count++) { if(str[count] >= 97 && str[count] <= 122) { continue; } else { str[count] = str[count] + 32; } } printf("\nAfter Character Conversion\n"); printf("\nNew String:\t%s\n", str); return 0; } |
Must Read: C Program To Find Strong Numbers using For Loop
Output

In case you get any Compilation Errors or any doubts in this C Program To Convert String into Lowercase letters with and without String Library Functions, let us know about it in the Comment Section below.
What is the significance of continue keyword in this C Program to convert string into lowercase characters? Cant we use break?
ASCII Values in the range 97 – 122 represent small case alphabets. If the alphabets in the string are already in lowercase, there is no need to manipulate them. Hence, the continue keyword is used. The continue keyword makes the loop re – iterate the complete loop once again. Hence, you only manipulate the character of the string if it is not a small case character.